How to get rid of unused indices in Display List

Hello Everyone,

This being my first question, please bear with me if i am not making sense.

Now the question is, Can i delete the indices which will not be used anymore, but they have been used in other Index.
For example:

GLuint firstIndex = glGenLists(1);
glNewList(firstIndex, GL_COMPILE);
//Some operations

//Now suppose i want a transformed version of this in my drawing, and i create a new genLists

GLuint secondIndex = glGenLists(1);
glNewList(secondIndex, GL_COMPILE);

Now after this statement if i do glDeleteList with firstIndex as parameter, secondIndex also doesn’t display anything. Is there any way i can clean these unwanted index from list?

You can’t.

Okay, So will my application have more memory consumption if i have lots of cases like this?

It depends on what’s stored in each display list. Display lists, by their nature, can be more memory intensive than anything else, but that’s something you need to accept as part of the trade-off.

Looking at what’s stored in a display list we can see that - in a simplified form - it’s just commands and data. Depending on how many commands and how much data you use, the memory requirements will vary.

Remember also that we’re talking about modern (or at worst, relatively modern) hardware here too. That means that memory is a cheap and plentiful resource that is there to be used. The days when you had to agonise over every few bytes are over. If you have the memory available, then use it - it’s going to waste otherwise. Using less memory doesn’t necessarily make a program faster or better. In fact it’s often slower as it may need to page from disk, compute things on the fly, or use formats that are not optimal, and more complex and/or fragile owing to the code setup needed for these things.

I’m thinking that sweating over memory usage at this early stage is a form of premature optimization. You likely don’t yet know the final memory usage of your program, so go ahead and use display lists like this. I think you’ll find that the memory overhead is going to be tiny compared to something like a 1024x1024 texture.

Why putting transformations inside display lists ? I don’t know what you really want to do, but as far as I can see, I don’t see any good reason to do so.

Let me try to explain. Suppose i have drawn a component(say component ‘A’) at origin which is just a part of my final drawing. Now using this component ‘A’ i have created one more list, or rather an array of list which contains many transformed version of component ‘A’.

Is there any way other than applying transformation in list, i can do this?

yes, simply apply transformation out from the list, this turns out. And it’s more quick to do so (no need to build display lists again).