Loading texture during runtime

If I ever try calling my texture loading function in DrawScene() instead of in InitGL(), it doesn’t load. Whats up?


rename your function DrawScene() to DrawSceneLoadTextureNOW(). That should fix the problem.

seriously, its impossible to tell you what you are doing wrong from your description. Maybe initgl() is called, and drawscene is not? maybe you’re calling initgl all the time, thereby trashing any texture you may have loaded in drawscene()?

follow the execution path of your code and put in trace writes when you pass the bitmap data to the GL state. Make sure what you THINK your program is doing is exactly what your program is doing.