void GLSLProgram::setUniform1f(const std::string& uniform, float a) {
     glUniform1f(getUniformLocation(uniform), a);
 }
Esempio n. 2
0
void shader::setUniform(const char *name, const mat3 &m) {
    int loc = getUniformLocation(name);
    if( loc >= 0 ) {
        glUniformMatrix3fv(loc, 1, GL_FALSE, &m[0][0]);
    }
}
Uniform ShaderProgram::operator[](const char *name) {
    return Uniform(this->id, getUniformLocation(std::string(name)));
}
Esempio n. 4
0
void OpenGLShader::setVec4f(std::string s, glm::vec4 v)
{
    int loc = getUniformLocation(s);
    glUniform4f(loc, v.x, v.y, v.z, v.w);
}
Esempio n. 5
0
void shader::setUniform(const char *name, float x, float y, float z) {
    int loc = getUniformLocation(name);
    if( loc >= 0 ) {
        glUniform3f(loc,x,y,z);
    }
}
	void ShaderObject::setUniformValue( std::string VariableName, int Value )
	{
		glUniform1i( getUniformLocation( VariableName ), Value );
	}
Esempio n. 7
0
void OpenGLShader::setInt(std::string s, int v)
{
    int loc = getUniformLocation(s);
    glUniform1i(loc, v);
}
Esempio n. 8
0
void ofShader::setUniform2f(const char* name, float v1, float v2) {
	if(bLoaded)
		glUniform2f(getUniformLocation(name), v1, v2);
}
Esempio n. 9
0
void ofShader::setUniform4f(const char* name, float v1, float v2, float v3, float v4) {
	if(bLoaded)
		glUniform4f(getUniformLocation(name), v1, v2, v3, v4);
}
Esempio n. 10
0
void ofShader::setUniform2i(const char* name, int v1, int v2) {
	if(bLoaded)
		glUniform2i(getUniformLocation(name), v1, v2);
}
Esempio n. 11
0
void ofShader::setUniform4i(const char* name, int v1, int v2, int v3, int v4) {
	if(bLoaded)
		glUniform4i(getUniformLocation(name), v1, v2, v3, v4);
}
 void GLSLProgram::setUniformMatrix4fv(const std::string& uniform, const glm::mat4& matrix) {
     //glUniform4fv(<#GLint location#>, <#GLsizei count#>, <#const GLfloat *value#>)
     
     glUniformMatrix4fv(getUniformLocation(uniform), 1, GL_FALSE, &(matrix[0][0]));
 }
 void GLSLProgram::setUniform1i(const std::string& uniform, GLint a) {
     glUniform1i(getUniformLocation(uniform), a);
 }
 void GLSLProgram::setUniform2fv(const std::string& uniform, GLsizei count, const float* val) {
     glUniform2fv(getUniformLocation(uniform), count, val);
 }
Esempio n. 15
0
void Z3DShaderProgram::setUniformValueArray(const QString &name, const glm::mat4 *values, int count, bool transpose)
{
  GLint l = getUniformLocation(name);
  setUniformValueArray(l, values, count, transpose);
}
Esempio n. 16
0
void ofShader::setUniform4fv(const char* name, float* v, int count) {
	if(bLoaded)
		glUniform4fv(getUniformLocation(name), count, v);
}
Esempio n. 17
0
	void ShaderObject::setUniformValue( std::string VariableName, Vector4 Value )
	{
		glUniform4f( getUniformLocation( VariableName ), Value.X, Value.Y, Value.Z, Value.W );
	}
Esempio n. 18
0
void Z3DShaderProgram::setUniformValue(const QString &name, GLfloat value)
{
  GLint l = getUniformLocation(name);
  setUniformValue(l, value);
}
Esempio n. 19
0
	void ShaderObject::setUniformValue( std::string VariableName, float Value1, float Value2 )
	{
		glUniform2f( getUniformLocation( VariableName ), Value1, Value2 );
	}
Esempio n. 20
0
void Z3DShaderProgram::setUniformValue(const QString &name, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
{
  GLint l = getUniformLocation(name);
  setUniformValue(l, x, y, z, w);
}
Esempio n. 21
0
void OpenGLShader::setFloat(std::string s, float v)
{
    int loc = getUniformLocation(s);
    glUniform1f(loc, v);
}
Esempio n. 22
0
void Z3DShaderProgram::setUniformValue(const QString &name, GLuint v1, GLuint v2, GLuint v3, GLuint v4)
{
  GLint l = getUniformLocation(name);
  setUniformValue(l, v1, v2, v3, v4);
}
Esempio n. 23
0
void OpenGLShader::setMat4f(std::string s, glm::mat4 v)
{
    int loc = getUniformLocation(s);
    glUniformMatrix4fv(loc, 1, GL_FALSE, glm::value_ptr(v));
}
Esempio n. 24
0
void Z3DShaderProgram::setUniformValue(const QString &name, const glm::uvec4 &value)
{
  GLint l = getUniformLocation(name);
  setUniformValue(l, value);
}
Esempio n. 25
0
void shader::setUniform(const char *name, const vec4 &v) {
    int loc = getUniformLocation(name);
    if( loc >= 0 ) {
        glUniform4f(loc,v.x,v.y,v.z,v.w);
    }
}
Esempio n. 26
0
void Z3DShaderProgram::setUniformValueArray(const QString &name, const glm::uvec4 *values, int count)
{
  GLint l = getUniformLocation(name);
  setUniformValueArray(l, values, count);
}
Esempio n. 27
0
void shader::setUniform( const char *name, bool val) {
    int loc = getUniformLocation(name);
    if( loc >= 0 ) {
        glUniform1i(loc, val);
    }
}
Esempio n. 28
0
void Z3DShaderProgram::setUniformValue(const QString &name, const glm::mat4 &value, bool transpose)
{
  GLint l = getUniformLocation(name);
  setUniformValue(l, value, transpose);
}
Esempio n. 29
0
DefaultShader::DefaultShader(GL3ShaderManager *manager) :
	Shader(manager, "shaders/default.vert", "shaders/default.frag")
{
	_lightEnabledLoc = getUniformLocation("lightEnabled");
	_ambientColorLoc = getUniformLocation("ambientLightColor");
	_diffuseColorLoc = getUniformLocation("diffuseLightColor");
	_diffuseDirectionLoc = getUniformLocation("diffuseLightDirection");
	_modelMatrixLoc = getUniformLocation("modelMatrix");
	_viewMatrixLoc = getUniformLocation("viewMatrix");
	_projectionMatrixLoc = getUniformLocation("projectionMatrix");
	_fogEnabledLoc = getUniformLocation("fogEnabled");
	_fogStartDistanceLoc = getUniformLocation("fogStartDistance");
	_fogEndDistanceLoc = getUniformLocation("fogEndDistance");

	GLint tmp;
	glUseProgram(getProgramLocation());
	tmp = getUniformLocation("textureSampler");
	glUniform1i(tmp, 0);
	tmp = getUniformLocation("fogSampler");
	glUniform1i(tmp, 1);
}
Esempio n. 30
0
//--------------------------------------------------------------
void ofShader::setUniformMatrix4f(const string & name, const ofMatrix4x4 & m, int count)  const{
	if(bLoaded) {
		int loc = getUniformLocation(name);
		if (loc != -1) glUniformMatrix4fv(loc, count, GL_FALSE, m.getPtr());
	}
}