View Full Version : glutPostReDisplay() and object loading

11-22-2002, 04:05 PM
In my opengl app that I am making i have an object that i load from a file into my app. However I dont want the object to reload itself everytime (because of memory problems and a major performance hit) a glutPostRedisplay is called. Is there an easy way to get this done. Thanks.

11-23-2002, 02:50 AM
glutPostRedisplay() only tells GLUT to recall the display function you registered with glutDisplayFunc() after its loop is finished.

If you're loading the models/textures in this display function then of course you'll have serious problems.

The display function is only mean to do one thing: to display what you want.
Other stuff, such as loading models, should be done elsewhere.

What you might want to do is to load your models before you call glutMainLoop().

Otherwise if you really can't get the loading routine out of the display loop, then do something like this:

if (! ModelLoaded)