I’m trying to get setup so that I can keep several LODs of a given mesh in a single VBO. I’m having some issues getting both glDrawArrays and glDrawElements to behave as I expect them to.
Say I have a VBO setup containing Position(vec3)/Color(vec3) attributes interleaved:
- Mesh 1 Vertex 0 - 100 (0 - 2400 bytes)
- Mesh 2 Vertex 100 - 300 (2400 - 7200 bytes)
A VAO has been setup enabling both attributes and pointing to their respective starting offsets of vertex 0.
Now if I wanted to draw mesh 1 and 2 I would expect I could just use:
glDrawArrays(GL_PRIM, 0, 100)
glDrawArrays(GL_PRIM, 100, 100)
this does however not work. It looks like changing the “first” param doesn’t do anything.
I’m having some issues figuring out glDrawElements as well as I’m also having problems with that. Say the VAO has an IBO activated as well.
I would expect:
glDrawElements(GL_PRIM, 100, GL_TYPE, sizeof(GL_TYPE) * 100) to render mesh 2 however it doesn’t.
Could anyone confirm that there are nothing wrong with my assumptions on how this works? I’m primarily a DX guy.