shaders/vbo's for the scene+shaders/imediate mode for the HUD=occasional crash

Started by Eternity, September 01, 2009, 20:35:17

Previous topic - Next topic

Eternity

Hey.

in my render cycle after i draw my whole scene i change my projection matrix to ortho and then i render the 2D overlay stil using my shaders but using imediate mode.
this works but about 20% of the time it crashes at Display.update() on the first frame where it has to draw both 3D and 2D stuff...

using GL11.glGetError ive tracked the problem to the imediate mode block's(in which i typically draw textured quads) in my 2D componants. the error code returned is 1282.

Any idea what might cause this?
Thnx in Advance!

ryanm

Error 1282 is a GL_INVALID_OPERATION. Narrow it down further until you find out the exact call that causes the error and then check the OpenGL docs to find the conditions under which that call can raise that error.
I'm afraid that's about as much help as anyone can give you based on the current information.

Eternity

wel. it seems i cant use  GL11.glGetError() inbetween GL11.glBegin and GL11.glEnd anyway since that wil crash regardless. plz tel me if thats not suposed to be the case.

so instead i use GL11.glGetError() right after GL11.glEnd().

the only things called inbetween GL11.glBegin and GL11.glEnd is glTexCoord2f and glVertex2f.

im guesing this is stil not enuf info...

Ciardhubh

Quote from: Eternity on September 02, 2009, 17:17:27
wel. it seems i cant use  GL11.glGetError() inbetween GL11.glBegin and GL11.glEnd anyway since that wil crash regardless. plz tel me if thats not suposed to be the case.

That's correct. See here: http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html

Quote from: Eternity on September 02, 2009, 17:17:27
so instead i use GL11.glGetError() right after GL11.glEnd().

the only things called inbetween GL11.glBegin and GL11.glEnd is glTexCoord2f and glVertex2f.

im guesing this is stil not enuf info...

Is the error thrown inside this begin-end block, i.e. was the state before begin no error and after the end it was an error? If so, maybe another glBegin hasn't been ended by an glEnd. You cannot nest begin-end pairs. Then again, if a begin wouldn't have been ended, glgeterror should itself cause an invalid op. glvertex and gltexcoord never cause an invalid op themselves according to the OpenGL API.

Worst case, you can add a glgeterror after every GL call until you've found the call responsible. Then check the ref pages http://www.opengl.org/sdk/docs/man/ to find out under which circumstances this call throws the error.

Eternity

ya i check for errors before glBegin as wel... there was none. Think it might be a driver bug and i got tired of trying to get imediate mode and VBO's working at the same time so i just changed my 2D rendering code from imediate mode to using a VBO that contains only 1 quad... thus making a glDrawArray call for every texture that i want to draw in 2D space instead of a glBegin/glEnd block

should have just done so from the start ;p

Thnx!