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

glDrawRangeElements vs glDrawElements and VBOs

Started by GamerSg Nov 23, 2003 at 2:41 AM 5 replies 5.6k views
Original Post
GamerSg
GamerSg
Finally im going to start using extensions and want to use the VBO extension first since it is supported on anything above the TnT. I read the article on nVidias site about using VBOs and they say using glDrawRangeElements is more efficient. WHat i cannot understand is how it make the function more efficient. Could someone explain to me what glDrawRangeElements does less than glDrawElements in simple English? Why does OpenGL have to scan glDrawElements?
jesterlecodeur
jesterlecodeur
Probably it pre-process the range and then use it as a lookup with the indices, so there isn''t any vertex which is transformed twice.

It suppose it when i read from the manpages:

quote:
There is no requirement that all vertices in the range [start,end] be referenced. However, the implementation may partially process unused vertices, reducing performance from what could be achieved with an optimal index set.


We could suppose, that if you use 3 indices in a range of 1000 vertices, I hope the driver don''t preprocess the whole range.

_______________

Jester, studient programmer
The Jester Home in French
_______________
Jester, studient programmerThe Jester Home in French
GamerSg
GamerSg
What if i am rendering a model and i intend to use all the vertices of the vertex array that i pass?

Should i just stick to DrawElements since i am using all the vertices in the array?



After reading through the document at nVidia''s site, i interpret the information as this:

The driver may use the range information and optimise the format of the indices array. For example it might convert 32-bit int into 16-bit int to reduce memory usage and speed up processing by a factor of 2.

Secondly it will also not need to scan the indices array, resulting in a speedup.

Is that correct?
Ready4Dis
Ready4Dis
quote:
Original post by jesterlecodeur
Probably it pre-process the range and then use it as a lookup with the indices, so there isn''t any vertex which is transformed twice.



That''s the reason I use compiled vertex arrays and glDrawElements, I don''t know if there are any benefits to using glDrawRangeElements, but I could look into it and test it in my code to see what kind of speed difference (if any) it has .
fireking
fireking
in compiled vertex arrays, you can lock and unlock the array. Locking the array tells opengl that we arent going to change anything inside of the array for now, so opengl might be able to find a way to speed it up based off this fact. When you change something, you unlock the array, which tells opengl that you are changing things. It''s pretty much like direct x''s vbo''s. The lock and unlock are available via the ARB.
--FirekingOwner/LeaderFiregames Development &Blackdragon Studios

Topic Locked

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

Sign in to reply to this topic.