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?
Perhaps its faster to execute them but not nessecarily faster to create them.
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:
- check wether the parameters are valid
- check wether we’re inside glBegin(), glEnd()
- set the correspondent internal GL state and dirty bit
- 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.
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.
Yah it would definatly work worser
Great, thanks for clearing this up for me, now I won’t waste my time trying it.
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.
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!
[This message has been edited by Heaven (edited 04-21-2003).]
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!