Hi All, I´m just starting with shaders,…so sorry for this ‘easy’ question.
I just want to test following shader:
void main()
{
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
}
I do it like following:
in a constructor of my class I:
- glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB)
- load the source of the shader
- load the shader to handle: glShaderSourceARB
- compile it: glCompileShaderARB
- get info: glGetInfoLogARB
// until now everything returns 0 (no error)
then in initializeGL I:
- create a program object glCreateProgramObjectARB();
- attach the shader glAttachObjectARB(prg, shader_vtx->handle_);
// here I’m getting glError - 1281[/b] - link the program: glLinkProgramARB(prg);
then in paintGL loop I:
- glUseProgramObjectARB(prg); // here I’m not 100% sure where to place it. I’m creating a VBO(drawElements, TRIANGLE_STRIP). But if I place it anywhere nothing changes (I’m getting still my old color) - shader should change it to green.
thank you in advance,…