Why does glGenLists return a value directly while glGenTextures uses a reference parameter?

This may be a bit OCD, but I feel annoyed that in OpenGL glGenLists return the list identifier directly, and glGenTextures use the reference parameter to return the identifier.

 GLuint glGenLists(GLsizei range); void glGenTextures(GLsizei n, GLuint * textures); 

Is there a good reason for this mismatch?

+4
source share
2 answers

Christian Rau addresses the right topic.

The reason glGenLists guarantees the ordering of the return value is a string drawing. The usage model wanted glListBase + glCallLists to allow simple

 // ascii model // init asciiBase = glGenLists(128); // usage glListBase(asciiBase); glCallList(strlen(string), GL_UNSIGNED_BYTE, string); 

For this usage model, you really need a range that needs to be contiguous. There was no such model designed for textures, so it was necessary to remove the required names, since it simplified the implementation of GL.

As an extra tidbit, note that glGen * calls are optional. Nothing bothers you:

 glBindTexture(GL_TEXTURE_2D, 5); // never called glGenTextures to get that 5!!! 
+3
source

I think that glGenLists returning directly are rather a religion from the past. The reason glGenTextures uses a pointer is because you can get more than one texture name. But for glGenLists, which is optional, since list ids generated by a single call to glGenLists (n) are guaranteed to have consistent values, so you can use glCallLists and glListBase efficiently. Therefore, you only need to know the first value.

But the identifiers of the text are not guaranteed to have this property, so you will need all n values ​​and, therefore, an array. I believe that when introducing texture objects (which appeared after the display lists), they realized that this call is much more general, since now you have no guarantee of implementing consecutive texture identifiers (which also has no advantages).

+2
source

All Articles