Posts Tagged 'opengl'

Z- or depth-related artefacts in GLSL shaders on iPhone 6/6 Plus

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 )

%d bloggers like this: