GL Studio C++ Runtime API
GlsUniform Class Reference

Public Member Functions

 GlsUniform (void)
 
 ~GlsUniform ()
 
GLint SetUniformLocation (GLuint programObject, const GLchar *name)
 
void SetUniform1i (int data)
 
void SetUniform2i (int *data)
 
void SetUniform3i (int *data)
 
void SetUniform4i (int *data)
 
void SetUniform1f (float data)
 
void SetUniform2f (float *data)
 
void SetUniform3f (float *data)
 
void SetUniform4f (float *data)
 
void SetUniform4f (float x, float y, float z, float w)
 
void SetUniform4fv (int size, float *data)
 
void SetUniformMatrix2f (float *data)
 
void SetUniformMatrix3f (float *data)
 
void SetUniformMatrix4f (float *data)
 
void SetDirtyFlag (void)
 

Protected Attributes

GLint _uniformLocation
 
bool _isDirty
 
union {
_data
 

Constructor & Destructor Documentation

GlsUniform ( void  )

Constructor. Sets the dirty flag and "invalid" uniform location.

~GlsUniform ( )
inline

Destructor. Does nothing.

Member Function Documentation

void SetDirtyFlag ( void  )

Mark this uniform as dirty, guaranteeing the uniform will be updated on the next set call.

void SetUniform1f ( float  data)

Set single float uniform data.

Parameters
[in]dataThe uniform value to set.
void SetUniform1i ( int  data)

Set single integer uniform data.

Parameters
[in]dataThe uniform value to set.
void SetUniform2f ( float *  data)

Set two float uniform data.

Parameters
[in]dataThe uniform value to set.
void SetUniform2i ( int *  data)

Set two integer uniform data.

Parameters
[in]dataThe uniform value to set.
void SetUniform3f ( float *  data)

Set three float uniform data.

Parameters
[in]dataThe uniform value to set.
void SetUniform3i ( int *  data)

Set three integer uniform data.

Parameters
[in]dataThe uniform value to set.
void SetUniform4f ( float *  data)

Set four float uniform data.

Parameters
[in]dataThe uniform value to set.
void SetUniform4f ( float  x,
float  y,
float  z,
float  w 
)

Set four float uniform data.

Parameters
[in]xthe first float value
[in]ythe second float value
[in]zthe third float value
[in]wthe fourth float value
void SetUniform4fv ( int  size,
float *  data 
)

Set four float uniform data vectors. Note that this method doesn't cache the old values, since we would have to dynamically allocate the cache memory based on size. Therefore, prefer SetUniform4f when just setting a single 4 float vector

Parameters
[in]sizethe number of 4 float vectors to set
[in]dataThe uniform value to set.
void SetUniform4i ( int *  data)

Set four integer uniform data.

Parameters
[in]dataThe uniform value to set.
GLint SetUniformLocation ( GLuint  programObject,
const GLchar *  name 
)

Grabs the uniform location for this uniform from the program object.

Parameters
[in]programObjectThe program that this uniform belongs to.
[in]nameThe name of the variable as provided to the shaders
Returns
The new uniform location, or -1 on failure.
void SetUniformMatrix2f ( float *  data)

Set 2x2 matrix uniform data.

Parameters
[in]dataThe uniform value to set.
void SetUniformMatrix3f ( float *  data)

Set 3x3 matrix uniform data.

Parameters
[in]dataThe uniform value to set.
void SetUniformMatrix4f ( float *  data)

Set 4x4 matrix uniform data.

Parameters
[in]dataThe uniform value to set.

Member Data Documentation

union { ... } _data

Convenience Union for comparing data.

bool _isDirty
protected

If true, the uniform data should be sent to the program object. Defaults to true.

GLint _uniformLocation
protected

The uniform location as provided by the shader program. Defaults to -1.


The documentation for this class was generated from the following file: