JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::OpenGLShaderProgram::Uniform Struct Reference

Represents an openGL uniform value. More...

#include <juce_OpenGLShaderProgram.h>

Collaboration diagram for juce::OpenGLShaderProgram::Uniform:

Public Member Functions

 Uniform (const OpenGLShaderProgram &program, const char *uniformName)
 Initialises a uniform. More...
 
void set (GLfloat n1) const noexcept
 Sets a float uniform. More...
 
void set (GLint n1) const noexcept
 Sets an int uniform. More...
 
void set (GLfloat n1, GLfloat n2) const noexcept
 Sets a vec2 uniform. More...
 
void set (GLfloat n1, GLfloat n2, GLfloat n3) const noexcept
 Sets a vec3 uniform. More...
 
void set (GLfloat n1, GLfloat n2, GLfloat n3, float n4) const noexcept
 Sets a vec4 uniform. More...
 
void set (GLint n1, GLint n2, GLint n3, GLint n4) const noexcept
 Sets an ivec4 uniform. More...
 
void set (const GLfloat *values, int numValues) const noexcept
 Sets a vector float uniform. More...
 
void setMatrix2 (const GLfloat *values, GLint count, GLboolean transpose) const noexcept
 Sets a 2x2 matrix float uniform. More...
 
void setMatrix3 (const GLfloat *values, GLint count, GLboolean transpose) const noexcept
 Sets a 3x3 matrix float uniform. More...
 
void setMatrix4 (const GLfloat *values, GLint count, GLboolean transpose) const noexcept
 Sets a 4x4 matrix float uniform. More...
 

Public Attributes

GLint uniformID
 The uniform's ID number. More...
 

Private Attributes

const OpenGLContextcontext
 

Detailed Description

Represents an openGL uniform value.

After a program has been linked, you can create Uniform objects to let you set the uniforms that your shaders use.

Be careful not to call the set() functions unless the appropriate program is loaded into the current context.

Constructor & Destructor Documentation

◆ Uniform()

juce::OpenGLShaderProgram::Uniform::Uniform ( const OpenGLShaderProgram program,
const char *  uniformName 
)

Initialises a uniform.

The program must have been successfully linked when this constructor is called.

Member Function Documentation

◆ set() [1/7]

void juce::OpenGLShaderProgram::Uniform::set ( GLfloat  n1) const
noexcept

Sets a float uniform.

◆ set() [2/7]

void juce::OpenGLShaderProgram::Uniform::set ( GLint  n1) const
noexcept

Sets an int uniform.

◆ set() [3/7]

void juce::OpenGLShaderProgram::Uniform::set ( GLfloat  n1,
GLfloat  n2 
) const
noexcept

Sets a vec2 uniform.

◆ set() [4/7]

void juce::OpenGLShaderProgram::Uniform::set ( GLfloat  n1,
GLfloat  n2,
GLfloat  n3 
) const
noexcept

Sets a vec3 uniform.

◆ set() [5/7]

void juce::OpenGLShaderProgram::Uniform::set ( GLfloat  n1,
GLfloat  n2,
GLfloat  n3,
float  n4 
) const
noexcept

Sets a vec4 uniform.

◆ set() [6/7]

void juce::OpenGLShaderProgram::Uniform::set ( GLint  n1,
GLint  n2,
GLint  n3,
GLint  n4 
) const
noexcept

Sets an ivec4 uniform.

◆ set() [7/7]

void juce::OpenGLShaderProgram::Uniform::set ( const GLfloat *  values,
int  numValues 
) const
noexcept

Sets a vector float uniform.

◆ setMatrix2()

void juce::OpenGLShaderProgram::Uniform::setMatrix2 ( const GLfloat *  values,
GLint  count,
GLboolean  transpose 
) const
noexcept

Sets a 2x2 matrix float uniform.

◆ setMatrix3()

void juce::OpenGLShaderProgram::Uniform::setMatrix3 ( const GLfloat *  values,
GLint  count,
GLboolean  transpose 
) const
noexcept

Sets a 3x3 matrix float uniform.

◆ setMatrix4()

void juce::OpenGLShaderProgram::Uniform::setMatrix4 ( const GLfloat *  values,
GLint  count,
GLboolean  transpose 
) const
noexcept

Sets a 4x4 matrix float uniform.

Member Data Documentation

◆ context

const OpenGLContext& juce::OpenGLShaderProgram::Uniform::context
private

◆ uniformID

GLint juce::OpenGLShaderProgram::Uniform::uniformID

The uniform's ID number.

If the uniform couldn't be found, this value will be < 0.


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