glUseProgram - how to "un-use"? [resolved]

Started by
3 comments, last by V-man 15 years, 10 months ago
Hi, Is there a way to tell OpenGL to not use any custom shader program after glUseProgram has been called? My scene graph activates shaders for certain objects, but not all objects require the use of a shader. Thanks!
Advertisement
glUseProgram(0);
Thanks for the super-quick reply.
For some reason, I get an INVALID_OPERATION error when I make that call. According to the spec, the function call will generate an error in the following cases:

GL_INVALID_VALUE is generated if
program is neither 0 nor a value
generated by OpenGL.

GL_INVALID_OPERATION is generated if
program is not a program object.

GL_INVALID_OPERATION is generated if
program could not be made part of current
state.

GL_INVALID_OPERATION is generated if
glUseProgram is executed between the
execution of
glBegin
and the corresponding execution of
glEnd.

There are no glBegin/glEnd calls in my program at all (using glDrawElements), and the first 2 don't seem like they apply so all I am left with is case 3 -- "Program could not be made part of the current state". Anyone have any idea what could cause that?
Either there is no context or some other GL call generated the error and it only appears when you call glUseProgram. I can't think of anything else. Break down the problem to a small reproduceable case and upload it for people to test.
Sig: http://glhlib.sourceforge.net
an open source GLU replacement library. Much more modern than GLU.
float matrix[16], inverse_matrix[16];
glhLoadIdentityf2(matrix);
glhTranslatef2(matrix, 0.0, 0.0, 5.0);
glhRotateAboutXf2(matrix, angleInRadians);
glhScalef2(matrix, 1.0, 1.0, -1.0);
glhQuickInvertMatrixf2(matrix, inverse_matrix);
glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

This topic is closed to new replies.

Advertisement