Display.update() raising GL error: Invalid value

Can someone enlighten me as to what sort of conditions would cause Display.update()'s call to Context.swapBuffers() to raise a GL error: Invalid Value? I see that Display.update() does this:


	// We paint only when the window is visible or dirty
		if (isVisible() || isDirty()) {
			Util.checkGLError();
			try {
				Context.swapBuffers();
			} catch (LWJGLException e) {
				throw new RuntimeException(e);
			}
		}


So the error must be arising from the Context.swapBuffers() call. (I check glError() after Display.update() completes)

The error only occurs the first time I Display.update(), afterwards no error occurs.

Any ideas?

Thanks!

No, thats not the case.

Util.checkGLError(); checks the drivers for any error that might have croped up anywhere in the last frame, Util.checkGLError(); releases those errors to be printed or whatever. You could be doing GL11.glLightf(GL11.glTrue); which is an invalid enum for that method call. Check the rest of your program carefully with a very fine toothcomb, if in doubt, put other Util.checkGLError(); calls in your code to see if the error has cropped up anywhere else…

DP

I wonder that we might tweak the generators so that one can produce a debug version of the GL interface that calls checkGLerror() after every operation. Good idea?

Cas :slight_smile:

well, as long as you can turn it off to avoid the JNI overhead that comes with it, im fine. the server VM should remove the dead-code anyway. IMO, its a good idea a long as performance doesnt suffer.

DP

We could have it so that it literally wrote out a different version of the GL11 class using Ant, and you’d use that whilst in development. I dunno.

Cas :slight_smile:

Very good idea! Will save loads of time.

its not just GL11 - GL20, but all of the extensions too…

If its two seperate jars, im happy and will definetly save alot of time!

DP

Util.checkGLError() checks the gl error state and finds it clean (otherwise it would throw an exception), after Display.update() completes, I check the gl error state and it is not clean (Invalid Value), so something that occured as a result of Context.swapBuffers() set the gl error state. My code is full of gl error checking already. The gl error state is clean when I call Display.update() and dirty when it completes.

Definetly a good idea - oh the wasted hours I could have saved…

Sounds “interesting”. I’d like to help, but I can’t do it without a small self-contained test case. What does the exact exception look like?

  • elias

Ok, if I can narrow it down I will certainly post it. I was hoping maybe someone had seen the behavior before :slight_smile: