View Full Version : Releasing OpenGL Objects
When my game is done, it releases the current class, and basically sends the program to the main menu, where the user can start the game all over again. Is there a problem if I don't delete the textures and stuff openGL uses, and then load them again? It seams to work now, but what about an 8 meg video card where repeat textures could fill up?
Sohta
2003.12.04, 07:02 PM
As long as you release the NSOpenGLView, the NSGLContext will be released, and the video memory should be cleaned then. You should be okay.
arekkusu
2003.12.10, 02:21 PM
Question about this--
does the NSOpenGLView retain the context? What about after [ctx clearDrawable]; [self clearGLContext]; ?
It seems like telling the view to clear the context would release it, but I am still leaking contexts.
In my app I maintain one view which I attach different contexts to (with various pixel formats) repeatedly. Each time I switch, I leak over a meg.
The funny thing is that after my view's init and applicationWillFinishLaunching, the context's retainCount is 2; one for my alloc and one for the view's [self setOpenGLContext:ctx]. But, the next time my code is called during the init, at reshape and drawRect, the retainCount is 3. And it never goes back to 0!
What else is glomming onto the NSOpenGLContext?
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.