Skip to main content
GameDev.net gamedev.net
🔒 Locked

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

Started by MattHughes May 9, 2008 at 5:08 PM 3 replies 12.6k views
Original Post
MattHughes
MattHughes
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!
HuntsMan
HuntsMan
glUseProgram(0);
MattHughes
MattHughes
Thanks for the super-quick reply.
Hubis
Hubis
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?
V-man
V-man
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.