PDA

View Full Version : Geometry shader with VBO



ropel
03-18-2007, 05:09 AM
Hi all,

I'm currently implementing a geometry shader, which I want to use, based on vertex buffer object as input. Geometry shader should take GL_POINTS as input and output.

Problem is that as soon as I attach the geometry shader GL produces the error that I'm not allowed to execute DrawArrays in the current context.

Is it possible to use a VBO together with a geometry shader and must I use the ARB extension functions to achieve this?

jra101
03-19-2007, 11:28 AM
You shouldn't have any problem using geometry shaders with VBOs, what is the exact error your seeing? Are you getting a GL_INVALID_OPERATION when you call glDrawArrays?

ropel
03-20-2007, 01:26 AM
That is indeed to problem! The marching cubes example uses something similar. But they use the ARB functions. Should I use these?

Furthermore I get a warning for each varying variable coming from the vertex shader that it might be initialized. Well of course it is initialized? Why this error?

Thanks

jra101
03-20-2007, 09:47 AM
Do you mean using the vertex buffer object functions added to OpenGL 1.5 (glBufferData, glGenBuffers, etc...) vs using the ARB_vertex_buffer_object functions (glBufferDataARB, glGenBuffersARB, etc...)? Assuming your card supports both OpenGL 1.5 and the ARB_vertex_buffer_object extension it shouldn't matter which you use.

Regarding the INVALID_OPERATION, it might be this error (from the NV_geometry_program4 extension spec):

If geometry programs are enabled, Begin, or any function that implicitly calls Begin, will produce an INVALID_OPERATION error if the <mode> parameter is incompatible with the input primitive type of the current geometry program.

ropel
03-21-2007, 01:27 AM
Thanks, that seemed to be the problem indeed. Works perfectly now :)