View Full Version : Passing class reference to renderscene() MainLoop

05-22-2010, 09:57 PM
Hey, I can't seem to get a texture loading class reference into my renderScene() function, it is not conducive to the glutDisplayfunc(). How the heck do I get the object in there?

05-23-2010, 01:27 AM
The Function you pass to glutDisplayfunc is your actual rendering function.

So, to get your texture "in" there, you'll need to define it globally or define a texture container class.

MyTexture gTexture;

void init()

void renderScene()
glBindTexture(GL_TEXTURE_2D, gTexture.getID() );
// or
gTexture.bind(); // depending on how you implemented your class
// draw stuff

I suggest you buying a good book about C++ and asking such questions in the beginner forum.