PDA

View Full Version : precompiled objects



Lanstorp
07-19-2002, 02:17 PM
How do one precompiled objects ?

Jakob

Morglum
07-20-2002, 08:57 AM
You mean, display lists ?
Here's how :

//first, get an id for our display list
unsigned int list_id;
glGenLists (1, &list_id);

//begin compiling
glNewList (list_id, GL_COMPILE);

//all what you draw here will be compiled, and will have no immediate effect on the screen

DrawMyObject ();

//stop compiling
glEndList

Later in your code, if you want to draw your object, instead of calling

DrawMyObject ();

just call

glCallList (list_id);

Lanstorp
07-20-2002, 11:37 AM
Thanks a lot http://www.opengl.org/discussion_boards/ubb/smile.gif Jakob


Originally posted by Morglum:
You mean, display lists ?
Here's how :

//first, get an id for our display list
unsigned int list_id;
glGenLists (1, &list_id);

//begin compiling
glNewList (list_id, GL_COMPILE);

//all what you draw here will be compiled, and will have no immediate effect on the screen

DrawMyObject ();

//stop compiling
glEndList

Later in your code, if you want to draw your object, instead of calling

DrawMyObject ();

just call

glCallList (list_id);