PDA

View Full Version : Any Advantages To Really Small Display Lists?



deadalive
04-18-2003, 07:49 AM
Just curious, I read somewhere (in the Red book I belive) that it could be faster to store ANYTHING in a display list, even one line state changes like glEnable(whatever)

Is this true? If so, wouldn't it be an advantage to create display lists for every glCommand?

31337
04-18-2003, 02:51 PM
Perhaps its faster to execute them but not nessecarily faster to create them.

zen
04-18-2003, 04:15 PM
I seriously doubt that a single glEnable in a list would be faster give the overhead caused by the list itself. Generally a state change incorporates a couple of steps like:
1) check wether the parameters are valid
2) check wether we're inside glBegin(), glEnd()
3) set the correspondent internal GL state and dirty bit
4) when its time to draw something and the gl state has changed make sure we can still render in HW
This list is by no means complete(or even correct) as I'm not a driver writer but you can see that some aspects of the change like 1 and 2 can be checked during list compilation wich should save time but others like 3 and 4 (which also costs the most I think) can't. Also if you put a glRotate call in a list(which isn't itself a state change but calls glMultMatrix interanlly) the matrix will be precomputed during compilation time but of course you can do that yourself as well. Anyway what I mean to say is that the state change itself should be faster but the list execution takes some time too so you'll have to win more than you'll lose for it to be worth the while.

Orzech
04-19-2003, 09:54 AM
In the Red Book it's also said that calling display lists also takes some time. I'm sure that making display list of single commands will work worser. It also depends of OpenGL implementation - so probably your OpenGL can manage to optimize your display lists.

Orzech

31337
04-19-2003, 11:54 AM
Yah it would definatly work *worser* http://www.opengl.org/discussion_boards/ubb/smile.gif

deadalive
04-21-2003, 05:30 AM
Great, thanks for clearing this up for me, now I won't waste my time trying it.

Orzech
04-21-2003, 10:10 AM
Originally posted by 31337:
Yah it would definatly work *worser* http://www.opengl.org/discussion_boards/ubb/smile.gif

*definatly* http://www.opengl.org/discussion_boards/ubb/smile.gif

Heaven
04-21-2003, 09:24 PM
Orzech and 31337, ROTFLMAO!

Anyway, say I'm displaying an array of points as "tiles". I've got a 64x64 array, each with a z value that I use to construct a set of 3x3 tiles.
http://www.knology.net/~heaven/images/tile.jpg

Would it be beneficial to set up a display list for each tile? Or still faster just to draw the 3x3 as 4 quads?

Does it matter that I may have thousands of individual tiles? A 64x64 = 4096 tiles, or 4096 display lists. A 256x256 = 65,536 display lists!

Thanks for any advice!

Take care.

[This message has been edited by Heaven (edited 04-21-2003).]

Orzech
04-22-2003, 12:14 AM
Hi!

There is one more solution. If your array doesn't change (tiles don't change) you can draw the whole 64x64 grid of tiles and make one display list of it. I am not sure if that's what you really want - it's in case you are making a floor in a scene or something. Anyway I would go for display lists rather than quads if you want to store these tiles separatly.

Hope it helps!

Orzech