glBegin mode on the graphics card

Is there any way of obtaining the primitive type from within the vertex shader. ie I want to know if I am rendering a triangle, quad, tristrip, quadstrip, point, line, linestrip. Set by the command glBegin(GL_XXXX);

As far as I can see in the glsl spec, the available state is limited to the current vertex, col, normal, matrix, lighting.

Is there a way to have that information without modifying the program.

You can give the primitive type through a custom uniform variable. I do not know if there is any kind of built-in in glsl that would already give this information.

No, there’s no such built-in variable. So, like dletozeun wrote - you have to specify it manually via a uniform.

boo :stuck_out_tongue:

haha, I suppose opengl cant give you everything. Information like that must be somewhere on the gfx card, but not exposed by vendor. Should this be a proposed ARB extension?

The information might be somewhere on the gfx card, but that doesn’t mean it’s anywhere near the vertex shader. In any case, this is easily handled by using a uniform, so I don’t see any need for an extension for this.