Geometry shader with VBO

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?

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?

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?


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.

Thanks, that seemed to be the problem indeed. Works perfectly now :slight_smile:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.