Reputation: 354
I can not understand displaylist clearly. For example, if I want to draw a scene with complex light and may change the material which used by objects in the scene. The speed of setting material may low, so I can put the definition of material in displaylist. So what's the advantage of using displaylist?
Upvotes: 0
Views: 1121
Reputation: 162194
Display Lists essentially are macro recorders / players. When compiling a display list, the OpenGL implementation records all the commands sent to it into once single object. Unfortunally display lists are a bit cumbersome to work with. For example a display list will store data passed to texture objects (they used to be used as texture store in OpenGL-1.0, ca. 1992, before the introduction of texture objects), but they won't store geometry data drawn through vertex arrays.
Any performance gains obtained through display lists are due to the possibility of batching up a lot of immediate mode calls, as a (GPU side) vertex array allows. With Vertex Buffer Objects available, this use of display lists became obsolete. This was about around 2000. The only remaining use of display lists was to encapsulate OpenGL state settings, which was usefull, as setting keeping book of the state for the fixed function pipeline was quite tedious. Ever since OpenGL got fully shader based much of the fixed function state became obsolete as well. Today what you've done by calling a gazillion of OpneGL state calls (or one glCallLists) is replaced by simply selecting the right shader program for the task at hand.
Ever since the display lists are completely obsolete and offer no viable performance gain.
It's also noteworthy, that OpenGL side matrix math operations (glLoadIdentity, glTranslate, glRotate, etc.) are not performed by the GPU. The matrix is prepared by the driver and then just uploaded to the GPU. Display lists just store the prepared matrix and upload it as well. But from a bandwidth and performance point of view, there's no difference in calling glUniform / glLoadMatrix yourself or having a display lists trigger that codepath. So Khronos did the reasonable thing and removed display lists from any modern OpenGL version and variant.
TL;DR: Display Lists used to be a usefull tool when Vertex Buffer Objects were not available to put geometry into fast memory and to compile larger sets of OpenGL state into an single name. On modern OpenGL display lists no longer offer advantages and would just increase driver size and complexity, so display lists have been removed from modern OpenGL variants.
Upvotes: 4