glDrawRangeElements & IndexBuffer, Performance hit?

Started by
4 comments, last by FXACE 14 years, 5 months ago
hey folks, I've got a little question. I'm using VBO and and IBO (GL_ELEMENT_ARRAY_BUFFER) and bind them. I found the glDrawRangeElements call quite nice since it allows me to store a single large index buffer per mesh und use differnet "views" to set up the material. Everything in my code is running fine, my question is performancewise. my call looks more or less like this glDrawRangeElements( GL_TRIANGLES,x1,x2,(GLsizei)pIdxBufferView->GetCount(),GL_UNSIGNED_INT,(GLvoid*)pIdxBufferView->GetStartIndex()*sizeof(uint32_t) ); I can see that x1 and x2 are valuable when not using VBO & IBO. Is there a performance hit when using x1=0 and x2 = GL_MAX_ELEMENTS_VERTICES (when using VBO&IBO)??? thanks a lot in advance zqueezy
Advertisement
GL_MAX_ELEMENTS_VERTICES is just a name for the value 0x80E8, which has no meaning except for being a unique identifier you pass to glGetInteger as a query. And even when querying the limit and using that, you should not tell OpenGL that the array contains more vertices that it actually does.
the glGet thing wasn't what I meant. In fact I did use glGet.
But I don't see how this would effect speed since the buffer is already uploaded via binding (and on the GPU?).
If you are passing a value that is bigger than the size of the buffer, that is no good, it'll probably crash in some pcs, I remember that was one bug I had sometime ago.
You should know the size of the buffer, so why dont use the size of the buffer as argument?

Reference http://www.opengl.org/registry/specs/EXT/draw_range_elements.txt

If you're using glDrawRangeElements you must give it index-range values that make sense and are correct, otherwise you should be using glDrawElements. Any potential performance improvements that restricting the index range might offer are up to the driver/implementation and may or may not apply using VBOs.

Jans.
In my opinion even the texture with 2048x2048 is the good choice to rendering with meshes.
??? CPU & other processors doesn't like to enter to the memory so often.

This topic is closed to new replies.

Advertisement