PDA

View Full Version : opengl causing c# application to close


supagu
09-15-2005, 05:29 AM
i have a c++ dll in which i call
SDL_SetVideoMode with the flag:
SDL_OPENGL to init opengl for me.

Now i'm using this c++ dll in a c# project i create my opengl window/device then at the end of the c# method it closes the c# application (calls Dispose method, where normally it would call my paint method)

any ideas? maybe sdl is setting opengl up incorrectly for window mode for me or somehting?

anubis
09-15-2005, 06:13 AM
Well, are you entering any message loop after you open the window ?

supagu
09-16-2005, 11:36 PM
okay i debugged the sdl dll, and seems the problem is that they are making a temporary window init some OGL stuff then destroy the window. When this temporary window is destroyed it doing something bad in c# and then my c# application ends up calling dispose.

is there maybe a way i can hack things to dispose doesnt get called. ie. maybe unregister it with garbage collector while it sets up my engine window?

skitz_nz
09-23-2005, 04:41 PM
Not sure whether you've managed to solve your problem or not, but thought I'd mention this OpenGL wrapper for C#, which I've used for several projects. Its quite handy, doesn't require any additional DLLs or files, just a few .cs files to add to your project.

http://www.colinfahey.com/opengl/csharp.htm

Of course, it is no use if you want to use SDL for more than just graphics, but its a good resource nonetheless.