Skip to main content
GameDev.net gamedev.net
🔒 Locked

Question about glDrawRangeElements()

Started by cubicwang May 25, 2006 at 1:39 AM 1 replies 950+ views
Original Post
cubicwang
cubicwang
I use glDrawRangeElements() to draw mesh with sections. I use this function like this: glDrawRangeElements(GL_TRIANGLE_LIST, startIdx, endIdx, endIdx - startIdx, GL_UNSIGNED_SHORT, index) But no matter witch startIdx I give the function , it will draw the mesh start from the 0 index, I don't know why? Please Help!
zedzeek
zedzeek
youre using it wrong, look it up in the opengl2.0 spec (www.opengl.org)
glDrawRangeElements(GL_TRIANGLE_LIST, X, Y, Z,
X+Y DONT reference the same data as Z
Disgruntled Gamer
Disgruntled Gamer
What value is in index?? The index array is where glDrawElements and glDrawRangeElements get there vertices from. So unless you want to start from the beginning of the array everytime you need to change index to something different like &index[100], to start at the 100th element if thats where the indices for the RANGE of VERTICES that you are trying to draw.

I just started using this method myself and you mentioned drawing a single mesh. I had originally thought of using glDrawRangeElements myself, but since it was only a single mesh I thought why not just use all the vertices of the mesh and not worry about which vertices belong to which face. I think I won't use glDrawRangeElement unless I have many things to draw and it is easy to separate one meshes vertices from another meshes vertices. Right now I'm using glDrawElements with all the vertices of my mesh, I don't necessarily have to draw them all because I can still move the index array around just like I can in glDrawRangeElements.

Hope this helps.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.