Sign in to follow this  
zqueezy

glDrawRangeElements & IndexBuffer, Performance hit?

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?).

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this