glDrawRangeElements and Vertex Buffer Objects

It’s not clear from the official documentation, but when drawing elements from a vertex buffer (VBO) via a bound index buffer, the sixth and final parameter to glDrawRangeElements – indices – acts as an offset into the index buffer to the index of the first element to be rendered.

Moreover, the offset is given in bytes and not numbers of elements. So if the values in the index buffer are stored as, say, unsigned short integers – GL_UNSIGNED_SHORT – then the offset to the fifth element would be:
4 * sizeof( GLushort )

0 Responses to “glDrawRangeElements and Vertex Buffer Objects”

  1. Leave a Comment

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s


%d bloggers like this: