| GL Studio C++ Runtime API

Public Member Functions | Protected Attributes | List of all members
GlsUniform Class Reference

`#include <gls_es20_uniform.h>`

## Public Member Functions
| GlsUniform ()
| ~GlsUniform ()
GLint | SetUniformLocation (GLuint programObject, const char *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()

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] | data | The uniform value to set.

## ◆ SetUniform1i()

void SetUniform1i | ( | int | data | ) |

Set single integer uniform data.

Parameters

  [in] | data | The uniform value to set.

## ◆ SetUniform2f()

void SetUniform2f | ( | float * | data | ) |

Set two float uniform data.

Parameters

  [in] | data | The uniform value to set.

## ◆ SetUniform2i()

void SetUniform2i | ( | int * | data | ) |

Set two integer uniform data.

Parameters

  [in] | data | The uniform value to set.

## ◆ SetUniform3f()

void SetUniform3f | ( | float * | data | ) |

Set three float uniform data.

Parameters

  [in] | data | The uniform value to set.

## ◆ SetUniform3i()

void SetUniform3i | ( | int * | data | ) |

Set three integer uniform data.

Parameters

  [in] | data | The uniform value to set.

## ◆ SetUniform4f() [1/2]

void SetUniform4f | ( | float * | data | ) |

Set four float uniform data.

Parameters

  [in] | data | The uniform value to set.

## ◆ SetUniform4f() [2/2]

void SetUniform4f | ( | float | x,
|  | float | y,
|  | float | z,
|  | float | w
| ) |  |

Set four float uniform data.

Parameters

  [in] | x | the first float value
  [in] | y | the second float value
  [in] | z | the third float value
  [in] | w | the 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] | size | the number of 4 float vectors to set
  [in] | data | The uniform value to set.

## ◆ SetUniform4i()

void SetUniform4i | ( | int * | data | ) |

Set four integer uniform data.

Parameters

  [in] | data | The uniform value to set.

## ◆ SetUniformLocation()

GLint SetUniformLocation | ( | GLuint | programObject,
|  | const char * | name
| ) |  |

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

Parameters

  [in] | programObject | The program that this uniform belongs to.
  [in] | name | The 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] | data | The uniform value to set.

## ◆ SetUniformMatrix3f()

void SetUniformMatrix3f | ( | float * | data | ) |

Set 3x3 matrix uniform data.

Parameters

  [in] | data | The uniform value to set.

## ◆ SetUniformMatrix4f()

void SetUniformMatrix4f | ( | float * | data | ) |

Set 4x4 matrix uniform data.

Parameters

  [in] | data | The 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:

- gls_es20_uniform.h