glLists - why the hell is it faster to have multiple glBegin(GL_TRIANGLE) than one?!

Started by
0 comments, last by BlackSeeds 14 years, 7 months ago
Redundant calls to glBegin(GL_TRIANGLE) seem to be making my code faster by 3 times :O! Heres a pastie: http://www.pastie.org/612337 Basically List 5 is:

begin triangle list
vertex
vertex
vertex 
......
vertex
vertex
vertex
end triangle list
and List 6 is:

begin triangles
vertex
vertex
vertex
end triangles
begin triangles
vertex
vertex
vertex
end triangles
...
begin triangle list
vertex
vertex
vertex
end triangle list Both lists have the exact same number of triangles in them. When I run my code, list 5 takes 0.09 seconds to draw, and list 6 takes me only 0.03! Can anyone see if i'm doing something stupid in my code? Is this normal? Its convenient the later is faster, but I have no idea why and its driving me mad! :( Thanks in advance :D
Advertisement
When you compile a display list, the OpenGL calls you make are optimised by your graphics hardware, so when calling glCallList() the GPU is not necessarily executing the exact same instructions you called when the list was compiled.

During the compile lists process having losts of begins and ends must enable your GPU to optimise the rendering operations better. kind of wierd I know, but display lists are quiet old and the speed you get out of using them will vary depending on the GPU because of how the lists are compiled.

This topic is closed to new replies.

Advertisement