glGenLists argumnet

The argument specifies the number of contiguos display list blocks but i have no idea how this is of any practical information to me.

In all the examples they simply put 1 in the argument.

In what scenarios would i have a number other than 1?

display lists are deprecated - I wouldn’t worry too much about them useless you are maintain old code

Are you serious? What has replaced them then?

Well, as the term range suggests, the return value + the range supplied by the developer lends itself perfect for iteration, as this contrived example shows:

GLsizei range    = 10;
GLuint  baseIdx  = glGenLists(range);
GLsizei rangeMax = 0;

// check if lists could all be generated
if(baseIdx > 0)
   rangeMax = baseIdx + range;
  // setup lists
  for(GLsizei idx = baseIdx; idx < rangeMax; ++idx)
       glNewList(idx, GL_COMPILE);
         // .. setup code for specific idx

// assuming all went well we could something like
// rendering only lists with even index
  for(GLsizei idx = baseIdx; idx < rangeMax; ++idx)
    if(!(idx % 2))

// clean-up
glDeleteLists(baseIdx, range)


DISCLAIMER[/b]: The above example is untested and may not be error free!

glCallLists() works a little differently as it takes a void pointer to a list of names (i.e. values returned by glGenLists()). However, the API is inconsistent since you don’t get back an array and have to build that array yourself, if I’m not mistaken. In contrast, current APIs like glGenTextures(GLsizei n, GLuint * textures), let’s you specify a pointer to a contiguous block of memory directly and the parameter list of glDeleteTextures(GLsizei n, GLuint* textures) matches the generation API. BTW, display lists are fast but also completely static once set up so they don’t lend themselves to any streaming whatsoever. Also, since any state changes you compile into the list are static as well, you can’t, for instance, change a texture you want to use on the same unit used in the list since the list will simply override it.

Display lists aren’t deprecated. They have long been removed from core - with GL 3.1 to be exact.

There is no direct correlate. The way to go today is using vertex buffer objects if you want to be portable (core GL only) or use the NV bindless stuff if you’ve got an NVIDIA GPU. The latter I haven’t used myself but fellow board member Dark Photon suggested the following:

Before the end of the world finally hits us, you might want to check that stuff out. :wink:

you can continue to use display lists forever if you are just using opengl 1-2

They have long been removed from core

I stand corrected :frowning: