OpenGL and Document-Based Cocoa app
OpenGL and Document-Based Cocoa app
- Subject: OpenGL and Document-Based Cocoa app
- From: MoreMasters <email@hidden>
- Date: Sun, 24 Mar 2002 13:44:28 -0100
Hi,
I remember seeing something about troubles with OpenGL document-based
apps on the list a while ago, but a search found problems unrelated to
mine, so I'm running this one by you.
I have a Cocoa document-based app which displays OpenGL images, and all
works fine until the user closes a document window, whereupon it crashes.
MyDocument class handles the data (vertices etc etc) for the OpenGL
model, and manipulates it according to user input. MyOpenGLView asks for
this data from MyDocument whenever it needs to do so, via an IBOutlet.
This is the way I've done things so far, and have had no problems... all
my OGL programs have been single window apps up until now.
After stepping through the code with GDB it seems that when a document
is closed, MyOpenGLView lives on beyond MyDocument being dealloc'd, asks
for data from the now freed MyDocument object and promptly crashes.
Is there a way to ensure MyOpenGLView is dealloc'd first?
Is it shamefully obvious to someone that I'm going at this the totally
wrong way?
Is it the done thing to send data to the GLView, rather than have the GL
side ask for it?
Hope this makes sense, and TIA for any advice.
MM
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.