GL Studio C++ Runtime API
GlsUniform Class Reference

#include <gls_es20_uniform.h>

Public Member Functions

 GlsUniform ()
 
 ~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 ()
 

Protected Attributes

GLint _uniformLocation
 
bool _isDirty
 
union {
   int   as1i
 
   int   as2i [2]
 
   int   as3i [3]
 
   int   as4i [4]
 
   float   as1f
 
   float   as2f [2]
 
   float   as3f [3]
 
   float   as4f [4]
 
   float   asMat2 [4]
 
   float   asMat3 [9]
 
   float   asMat4 [16]
 
_data
 

Detailed Description

The GlsUniform class. Wraps an OpenGL shader uniform.

Constructor & Destructor Documentation

◆ GlsUniform()

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

◆ ~GlsUniform()

~GlsUniform ( )
inline

Destructor. Does nothing.

Member Function Documentation

◆ SetDirtyFlag()

void SetDirtyFlag ( )

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

◆ SetUniform1f()

void SetUniform1f ( float  data)

Set single float uniform data.

Parameters
[in]dataThe uniform value to set.

◆ SetUniform1i()

void SetUniform1i ( int  data)

Set single integer uniform data.

Parameters
[in]dataThe uniform value to set.

◆ SetUniform2f()

void SetUniform2f ( float *  data)

Set two float uniform data.

Parameters
[in]dataThe uniform value to set.

◆ SetUniform2i()

void SetUniform2i ( int *  data)

Set two integer uniform data.

Parameters
[in]dataThe uniform value to set.

◆ SetUniform3f()

void SetUniform3f ( float *  data)

Set three float uniform data.

Parameters
[in]dataThe uniform value to set.

◆ SetUniform3i()

void SetUniform3i ( int *  data)

Set three integer uniform data.

Parameters
[in]dataThe uniform value to set.

◆ SetUniform4f() [1/2]

void SetUniform4f ( float *  data)

Set four float uniform data.

Parameters
[in]dataThe uniform value to set.

◆ SetUniform4f() [2/2]

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

◆ SetUniform4fv()

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.

◆ SetUniform4i()

void SetUniform4i ( int *  data)

Set four integer uniform data.

Parameters
[in]dataThe uniform value to set.

◆ SetUniformLocation()

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.

◆ SetUniformMatrix2f()

void SetUniformMatrix2f ( float *  data)

Set 2x2 matrix uniform data.

Parameters
[in]dataThe uniform value to set.

◆ SetUniformMatrix3f()

void SetUniformMatrix3f ( float *  data)

Set 3x3 matrix uniform data.

Parameters
[in]dataThe uniform value to set.

◆ SetUniformMatrix4f()

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.

◆ _isDirty

bool _isDirty
protected

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

◆ _uniformLocation

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: