View Full Version : Geometry shader creation

The Little Body
04-16-2011, 07:22 PM

I begin with geometry shader and have a problem with the glCreateShader(GL_GEOMETRY_SHADER_EXT) that return a value of 0 :(

GLEW say that geometry shaders are supported


if (glewIsSupported("GL_VERSION_2_1"))

printf("Ready for OpenGL 2.1\n");

else {

printf("OpenGL 2.1 not supported\n");



if (GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader && GL_EXT_geometry_shader4)

printf("Ready for GLSL - vertex, fragment, and geometry units\n");

else {

printf("Not totally ready :( \n");



Ready for OpenGL 2.1
Ready for GLSL - vertex, fragment, and geometry units

But the id returned by glCreateShader(GL_GEOMETRY_SHADER_EXT) is always 0 :(

v = glCreateShader(GL_VERTEX_SHADER);

if( v == 0)
printf("can't create a GL_VERTEX_SHADER :( \n");
printf("The vertex shader as the id %d \n", v);

f = glCreateShader(GL_FRAGMENT_SHADER);

if( f == 0)
printf("can't create a GL_FRAGMENT_SHADER :( \n");
printf("The fragment shader as the id %d \n", v);

g = glCreateShader(GL_GEOMETRY_SHADER_EXT);
if( g == 0)
printf("can't create a GL_GEOMETRY_SHADER_EXT :( \n");
printf("The vertex shader as the id %d \n", v);

say this :

The vertex shader as the id 1
The fragment shader as the id 1
can't create a GL_GEOMETRY_SHADER_EXT :(

So, of course I have a core dump at each glProgramParameteriEXT(p,GL_GEOMETRY_...) found after :(

=> what is the good way for to have a valid geometry shader id returned by the glCreateShader() func ?

PS : g = glCreateShaderObjectARB(GL_GEOMETRY_SHADER_EXT) return too the value 0 :(

PS2 : the error returned by glGetError is 1282 (GL_INVALID_OPERATION)

The Little Body
04-16-2011, 09:07 PM
I find any geometry_shader string when I see at the NVIDIA X Server Setting (I use a GeForce 7100 GS on a Fedora 14)

On the OpenGL Information, the version is 2.1.2 NVIDIA 260.19.36

=> it's normal ?

Alfonse Reinheart
04-16-2011, 11:12 PM
if (GLEW_ARB_vertex_shader && GLEW_ARB_fragment_shader && GL_EXT_geometry_shader4)

It's been a while since I used GLEW, but shouldn't that last one be GLEW_EXT_geometry_shader4?

Also, if you're using GL 2.1, you shouldn't be using the ARB vertex and fragment shader extensions. You should be using the core functionality. There are significant API differences between the two.

I use a GeForce 7100 GS

Only GeForce 8xxx cards or better support Geometry shaders.

The Little Body
04-17-2011, 07:06 AM
Thank, Alfonse

No idea about EXT_geometry_shader4 vs GLEW_EXT_geometry_shader4 because it's the first time that I work with GLEW
(it's a fragment of code that I have found at http://cirl.missouri.edu/gpu/glsl_lessons/glsl_geometry_shader/index.html)

And I use effectively the core fonctionnality of fragment and vertex shaders (cf. not the ARB version) since a long time.

Can the geometry shader stage to be "emuled" or something like this ?

Or I have obligatory to have a GeForce 8xx for to can use geometry shaders ???
(I prefer to use a NVidia card because their cards work very fine on linux/opengl and are good maintened)

Have you a reference of a "good quality/price" GeForce 8xx ?
(and with a reseonable consommation because I don't want to install a radiator into my computer :) )

04-17-2011, 09:56 AM
Unlike D3D, OpenGL don't have HAL, so if something is not implemented in hardware/drivers, you cannot emulate it on CPU side (unless you are using CPU implementation, like Mesa3D, but Mesa3D is stuck at GL 2.1, so forget about software implementation of Geometry shaders).

Also, my advice is to forget about NV 8xxx cards. Soon you'll try to execute tessellation shaders, and you'll be at the same position where you are now. So, get some NV 4xx card.

04-17-2011, 12:38 PM
You may have difficulty finding a Geforce 8 in these times. If you want a recent Geforce which doesn't have a high power requirement, you can look for a Geforce GT 440 or Geforce GT 430, where the 440 is a slightly faster version of the 430. Both cards can be found for between 50 and 90 USD.