I have such a code:
items are added this way:Code:
static QList<display_list*> displayLists;
The problem is if I need to clear list and generate otehr display lists than displayLists.clear() is a bad choice - ~display_list() is not called for elements, in fact lists still reside in OpenGL memory. Currently I have such a header in function, that generates this list:Code:
list = new display_list(); list->new_list(GL_COMPILE); glBegin(GL_QUADS); ... glEnd(); list->end_list(); displayLists.append(list);
but I don't like it :confused:Code:
void prepareLists() { if(!displayLists.isEmpty()) foreach(display_list* ptr, displayLists) delete ptr; displayLists.clear(); ...
Any ideas how to make it nice&clean?
PS: display_list is not a QObject