Package com.jogamp.opengl
Class GLUniformData
- java.lang.Object
-
- com.jogamp.opengl.GLUniformData
-
public final class GLUniformData extends Object
GLSL uniform data wrapper encapsulating data to be uploaded to the GPU as a uniform.
-
-
Constructor Summary
Constructors Constructor Description GLUniformData(String name, float val)
float atom Number of objects is 1GLUniformData(String name, int val)
int atom Number of objects is 1GLUniformData(String name, int rows, int columns, SyncBuffer syncBuffer)
Multiple FloatBuffer Matrix Number of objects is calculated by data.limit()/(rows*columns)GLUniformData(String name, int rows, int columns, FloatBuffer data)
Multiple FloatBuffer Matrix Number of objects is calculated by data.limit()/(rows*columns)GLUniformData(String name, int components, SyncBuffer syncBuffer)
Multiple IntBuffer or FloatBuffer Vector Number of objects is calculated by data.limit()/componentsGLUniformData(String name, int components, FloatBuffer data)
Multiple FloatBuffer Vector Number of objects is calculated by data.limit()/componentsGLUniformData(String name, int components, IntBuffer data)
Multiple IntBuffer Vector Number of objects is calculated by data.limit()/components
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
columns()
int
components()
int
count()
static GLUniformData
creatEmptyMatrix(String name, int rows, int columns)
static GLUniformData
creatEmptyVector(String name, int components)
FloatBuffer
floatBufferValue()
float
floatValue()
Buffer
getBuffer()
Returns the data buffer.int
getLocation()
String
getName()
Return the uniform name as used in the shaderObject
getObject()
Returns the data object.IntBuffer
intBufferValue()
int
intValue()
boolean
isBuffer()
boolean
isMatrix()
int
rows()
GLUniformData
setData(float data)
GLUniformData
setData(int data)
GLUniformData
setData(SyncBuffer syncedBuffer)
GLUniformData
setData(FloatBuffer data)
GLUniformData
setData(IntBuffer data)
int
setLocation(int location)
Sets the given location of the shader uniform.int
setLocation(GL2ES2 gl, int program)
Retrieves the location of the shader uniform withgetName()
from the linked shader program.String
toString()
StringBuilder
toString(StringBuilder sb)
-
-
-
Constructor Detail
-
GLUniformData
public GLUniformData(String name, int val)
int atom Number of objects is 1- Parameters:
name
- the uniform name as used in the shader
-
GLUniformData
public GLUniformData(String name, float val)
float atom Number of objects is 1- Parameters:
name
- the uniform name as used in the shader
-
GLUniformData
public GLUniformData(String name, int components, IntBuffer data)
Multiple IntBuffer Vector Number of objects is calculated by data.limit()/components- Parameters:
name
- the uniform name as used in the shadercomponents
- number of elements of one object, ie 4 for GL_FLOAT_VEC4,data
- the data
-
GLUniformData
public GLUniformData(String name, int components, FloatBuffer data)
Multiple FloatBuffer Vector Number of objects is calculated by data.limit()/components- Parameters:
name
- the uniform name as used in the shadercomponents
- number of elements of one object, ie 4 for GL_FLOAT_VEC4,data
- the underlying data
-
GLUniformData
public GLUniformData(String name, int components, SyncBuffer syncBuffer)
Multiple IntBuffer or FloatBuffer Vector Number of objects is calculated by data.limit()/components- Parameters:
name
- the uniform name as used in the shadercomponents
- number of elements of one object, ie 4 for GL_FLOAT_VEC4,syncBuffer
-SyncBuffer
providingSyncAction
andBuffer
, allowing to sync the buffer with the underlying data, seegetBuffer()
-
GLUniformData
public GLUniformData(String name, int rows, int columns, FloatBuffer data)
Multiple FloatBuffer Matrix Number of objects is calculated by data.limit()/(rows*columns)- Parameters:
name
- the uniform name as used in the shaderrows
- the matrix rowscolumn
- the matrix columndata
- the underlying data
-
GLUniformData
public GLUniformData(String name, int rows, int columns, SyncBuffer syncBuffer)
Multiple FloatBuffer Matrix Number of objects is calculated by data.limit()/(rows*columns)- Parameters:
name
- the uniform name as used in the shaderrows
- the matrix rowscolumn
- the matrix columnsyncBuffer
-SyncBuffer
providingSyncAction
andBuffer
, allowing to sync the buffer with the underlying data, seegetBuffer()
-
-
Method Detail
-
creatEmptyVector
public static GLUniformData creatEmptyVector(String name, int components)
-
creatEmptyMatrix
public static GLUniformData creatEmptyMatrix(String name, int rows, int columns)
-
setData
public GLUniformData setData(int data)
-
setData
public GLUniformData setData(float data)
-
setData
public GLUniformData setData(IntBuffer data)
-
setData
public GLUniformData setData(FloatBuffer data)
-
setData
public GLUniformData setData(SyncBuffer syncedBuffer)
-
intValue
public int intValue()
-
floatValue
public float floatValue()
-
intBufferValue
public IntBuffer intBufferValue()
-
floatBufferValue
public FloatBuffer floatBufferValue()
-
toString
public StringBuilder toString(StringBuilder sb)
-
getName
public String getName()
Return the uniform name as used in the shader
-
getLocation
public int getLocation()
-
setLocation
public int setLocation(int location)
Sets the given location of the shader uniform.- Returns:
- the given location
-
setLocation
public int setLocation(GL2ES2 gl, int program)
Retrieves the location of the shader uniform withgetName()
from the linked shader program.No validation is performed within the implementation.
- Parameters:
gl
-program
-- Returns:
- ≥0 denotes a valid uniform location as found and used in the given shader program. <0 denotes an invalid location, i.e. not found or used in the given shader program.
-
getObject
public Object getObject()
Returns the data object.In case a
SyncAction
has been set, it is invoked tosynchronize
the object with the underlying data before returning the object.- Returns:
- the data object.
- See Also:
SyncAction.sync()
-
getBuffer
public Buffer getBuffer()
Returns the data buffer.In case a
SyncAction
has been set, it is invoked tosynchronize
the buffer with the underlying data before returning the buffer.- Returns:
- the data buffer.
- See Also:
SyncAction.sync()
-
isMatrix
public boolean isMatrix()
-
isBuffer
public boolean isBuffer()
-
count
public int count()
-
components
public int components()
-
rows
public int rows()
-
columns
public int columns()
-
-