Threaded View

Primitive Restart with a twist

As of OpenGL 3.x, primitive restart was added where when enabled if a particular user defined index was encountered, then the primitive creation was restarted (the biggest use case being triangle strips). I would like to make augment it as follows:

Primitive Restart Index 2 is enabled/disabled GL_PRIMITIVE_RESTART_INDEX_SOME_NICE_NAME when passed to glEnable/glDisable.When enabled, any one of the draw commands which transfers a set of generic attribute array elements to the GL the following will occur when index of the vertex is equal to the primitive restart index

will restart the primitive

the index following is NOT an index for an attribute. Rather it specifies the value gl_SomeGoodSoundingName used by any of the shading stages

The initial value of gl_SomeGoodSoundingName is 0 at the start of each draw command. For instancing, the value if reset to zero at the start of each instance.

The idea behind this is that there are a number of cases where an attribute is used as an index into an array. Very often, that index does not change a great deal. With this extension, one does not need to occupy an entire attribute for that index.