View Full Version : display lists
when is it appropriate to use display lists? i understand you can use them to build complex objects, but is there any benefit for using them to build simple objects like cubes or spheres?
02-14-2001, 10:30 AM
There is a little overhead asociated with calling display lists, but under most circumstances the overhead is low enough to warrant their use. A cube might be an exception, but a sphere is certainly a fairly complex shape (lots of triangles to construct a single sphere), and would probably benefit from a display list. I can't think of many circumstances when a display list would actually slow a program down significantly, as opposed to passing the vertices straight in.
I thought that using display lists is faster than simply passing vertices, because display lists are precompiled. Once I tried to build a display list from a 3D model, which was loaded to the memory from a file. So inside the glNewList/glEndList block I passed the triangles in a for loop, but it failed. I can think that there can be only gl instructions inside a display list, but this means that you can't store dinamically loaded (but static) meshes in a list. At least the number of the triangles must be fix and you have to write glVertex into your list hundreds of times. Or am I wrong?
The trick behind display lists is that they MIGHT be pre-compiled and they MIGHT have over-head, but this isn't necessarily for certain. True, display lists give the opengl implementation scope to recorganise the structure you send into a structure that is more efficient for the graphics h/w (converting, for example, a rectangular strip into a triangular strip). There is nothing to say, however, that a display list in an ogl impl needs to be precompiled.
I'm not sure what's going on with your disply lists, dev, but you can have non gl-code between yoru glNewList glEndList, since creating a list only captures gl calls... unless you're doing something like changing the projection matrix, I can't think of what could be wrong. I've written an ogl program that has an option to send a pretty complicated structure to a display list as its being rendered (the list and execute thing) without any problems. (Incidentially, it kills the performance on a SGI o2, but the onyx streams all over it wihtout any detectable loss in performance. VerrrrRRrry nice=)
02-15-2001, 04:45 AM
Consider that when using certain effects like bump mapping you need to do more than 1 pass, changing parameters like tex coords. If you keep data only in a display list, you can't do it.
I use both disply lists and glxxxx: when I need to draw the plain object, i call a d.l., when I have to use some effect I use the vetrices and faces data I stored in some array.
Sure you can use any type of non gl commands when building display lists.
[This message has been edited by Teofuzz (edited 02-15-2001).]
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.