Does OpenGL/OpenGLES VBO hold only same size vertex?
I’m asking because i found that the parameters for glDrawElements have offset value for index buffer only (its last parameter), this means :
1. i have to manually offset my indices before submit them to IBO if buffers already been partly filled. anyway, manually offset indices is easy, so its not a problem here.
2. the VBO being used as vertex buffer must holds same size vertices or the indices are meaningless.
This behavior is different from DirectX Vertex Buffer, in directx, there is a SetStreamSource, which can be used to offset Verterx Buffer, along with DrawIndexedPrimitive your VB can hold vertices in arbitrary size.
maybe OpenGLES 1.1 version of SetStreamSource is not available? maybe OpenGLES 2.0 will support it?
My Target platform is iPhone OpenGLES 1.1, so if the GL version SetStreamSource is not available im going to give up using VBOs because :
1. it brings more trouble (i’ll have to allocate many VBOs holding different size vertex)
2. there is no performance improvement anyway (no hardware support in OpenGLES 1.1)
thanks for reading and thanks a lot for sharing your experience about correct ways to use VBOs in OpenGLES 1.1., thank you.
OpenGL buffer objects (VBO is one of the usage patterns) can contain arbitrary information. But the draw functions (like
glDrawElements) work on a continuous array of same-formatted vertex information (obviously, each vertex occupies the same size). If that’s the size you were asking about – then I don’t see how it can be altered.If you want to use the VBO from the specific offset (for example, containing vertices of a different format) – then there is a last parameter of
glVertexAttribPointerfor you. When VBO is bound, this last parameter is a byte offset of the data segment used for vertex attributes.