PDA

View Full Version : How to copy one displyList to another displayList?



tgtt
02-14-2004, 12:23 AM
glNewList(i,GL_COMPILE);
..do something
glEndList();

int j=glGenList();

copylist(i,j);//how to make this to copy i to j

glDeleteList(i);//must delete list i

glCallList(j);

zeckensack
02-14-2004, 02:36 AM
You can't. That would be useless functionality.

Display lists are immutable. So your copy would just do the *exact* same thing as the original display list. Copying it and destroying the old version is pure overhead with no conceivable benefit.

chemdog
02-16-2004, 05:03 AM
//how to make this to copy i to j
void copylist(GLuint i, GLuint j)
{
glNewList(j, GL_COMPILE);
glCallList(i);
glEndList();
}

Bob
02-16-2004, 05:32 AM
Originally posted by chemdog:
//how to make this to copy i to j
void copylist(GLuint i, GLuint j)
{
glNewList(j, GL_COMPILE);
glCallList(i);
glEndList();
}
That won't create a copy of i called j, it will create a display list called j which contains the display list i. The important difference is what happens when i is deleted; j will no longer work because i is gone.

[This message has been edited by Bob (edited 02-16-2004).]