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?
As long as you release the NSOpenGLView, the NSGLContext will be released, and the video memory should be cleaned then. You should be okay.
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?
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?
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| First Person Objects (Gun) in OpenGL | mikey | 21 | 7,688 |
Jun 3, 2009 11:01 AM Last Post: mikey |
|
| openGL 2d drawing problems, objects appear to overlap | matthew | 12 | 4,773 |
Oct 5, 2003 07:53 PM Last Post: matthew |
|
| drawing objects in openGL, plane question. | xDexx | 7 | 4,524 |
Apr 28, 2003 01:06 PM Last Post: OneSadCookie |
|
| Placing Quesa Objects in an OpenGL Context? | lpetrich | 2 | 2,484 |
Feb 13, 2003 06:53 AM Last Post: -dair |
|

