Using gl_VertexID without any VBOs.

Normally, gl_VertexID is the index of the currently rendered vertex element.

When you provide indices (GL_ELEMENT_ARRAY_BUFFER), gl_VertexID should match the value provided. Ie, the gl_VertexID value can repeat if you render the same element multiple times.

 

I say “should”, because this is NOT correct when you haven’t provided any VBO data.

This means, that if you are rendering using nothing but a shader and a GL_ELEMENT_ARRAY_BUFFER, the gl_VertexID will NOT match the indices you provide, and will instead be a sequence from 0 -> N.

The solution is to use a single VBO and use glDrawArrays.

 

Personally, I consider this a bug.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: