0

If an existing compiled display list is to be recompiled, is it necessary to call glDeleteLists() and glGenLists() first? Or can the display list be recompiled by just calling glNewList() on the existing compiled display list ID?

1 Answer 1

4

Just calling glNewList/glEndList should be enough.

Note that the deletion only becomes effective on the glEndList call:

If a  display list with name `list` already exists, 
it is replaced only when glEndList is called.

If you'd rather have the previous list freed earlier, then by all means, do call glDeleteLists. Being explicit certainly does not hurt.

Last bit... glGenLists is never required. You can always call glNewList on any positive integer, even if it was not provided through glGenLists. The main reason for the glGenLists API is to make sure the name is not already in use. But you already know that if you just deleted it.

Sign up to request clarification or add additional context in comments.

2 Comments

So not calling glDeleteLists() won't cause some sort of server-side memory leak? Also, does it work the same for other server-side objects like textures, buffer objects, etc.?
not calling Delete* on an object before reallocating that handle should not leak (but bugs in implementations can exist). It's part of GL's job to make sure it does not leak there. It's true for all objects where you can decide the name (like textures and buffer objects).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.