PDA

View Full Version : glDrawRangeElements -> INVALID_OPERATION



MalcolmB
04-11-2007, 12:34 PM
Hi,
I"m using glDrawRangeElements with VBOs to render my geometry. In a few cases I get a GL_INVALID_OPERATION error when I call this function (it works 99% of the time without error).

I've verified that I'm not inside a Begin/End block, and I've verified that none of the VBOs I'm using are mapped.

Looking at the VBO spec I can't see any other reasons why an INVALID_OPERATION error would be given. Anyone have any ideas on what else I should look for?

Btw, glDrawArrays gives the same error.

Thanks

Komat
04-11-2007, 04:19 PM
Originally posted by MalcolmB:

Looking at the VBO spec I can't see any other reasons why an INVALID_OPERATION error would be given. Anyone have any ideas on what else I should look for?
There are situations when validity of OGL state can be checked only during draw call. In some such cases the drawing functions generate INVALID_OPERATION when the state is found to be currently invalid.

Some examples are:
Shader program that has sampler uniforms with different types (e.g. 2d and Cube) that reference the same texture unit (e.g. unit 0 which is default value for sampler uniforms after program is linked). Shader program references more than allowed number of textures if that can not be checked at link time. Invalid arb_vertex_program is currently bound and enabled. Use of primitive type that is not compatible with current geometry shader.

Look for something that is special on the failing calls. Are all sampler uniforms set correctly (see above)? Is there some extension in use or do they use some specific setting?