As far as I know, this code should work:
void
MyClass::draw()
{
if (this->pshader->isLinked()) {
int val_loc = this->pshader->attributeLocation("val");
this->pshader->setUniformValue(val_loc, (GLfloat)1.0);
}
// OpenGL stuff
}
void
MyClass::draw()
{
if (this->pshader->isLinked()) {
int val_loc = this->pshader->attributeLocation("val");
this->pshader->setUniformValue(val_loc, (GLfloat)1.0);
}
// OpenGL stuff
}
To copy to clipboard, switch view to plain text mode
Vertex shader:
uniform float val;
varying float new_val;
void main()
{
new_val = val;
gl_Position = ftransform();
}
uniform float val;
varying float new_val;
void main()
{
new_val = val;
gl_Position = ftransform();
}
To copy to clipboard, switch view to plain text mode
Fragment shader:
varying float new_val;
void main()
{
if (new_val < 0.5)
gl_FragColor = vec4(1.0,0.0,0.0,1.0);
else
gl_FragColor = vec4(0.0,0.0,1.0,1.0);
}
varying float new_val;
void main()
{
if (new_val < 0.5)
gl_FragColor = vec4(1.0,0.0,0.0,1.0);
else
gl_FragColor = vec4(0.0,0.0,1.0,1.0);
}
To copy to clipboard, switch view to plain text mode
but my object appears red...
Bookmarks