puklaus's picture

destroy GameWindow


Im using window that is created by GameWindow, but im not using its loop (Run()).
I have problem when I stop program, it always crashes (stack trace etc) on
linux, so I made new method (copied from GameWindow.cs, from Run() methods):

        public void DestroyGameWindow()
            if (Exists)
                glContext = null;
            while (this.Exists)

and when I call that on my Destroy() method, it works, no crash.

So, is there another way to do this because this is kind of hack?

Or then maybe add this or like this in the opentk?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

Yes, OpenTK will gain support for custom main loops. You will simply inherit from GameWindow (or NativeWindow) and override the implementation (or even provide a completely custom interface in the case of the NativeWindow).

The work right now goes to the gw-next branch, but it is not yet ready for public consumption.

puklaus's picture

"You will simply inherit from GameWindow "

:) I think im tired, i havent even think that when I start modified opentk sources.
So i made this, and it seems work because linux doesnt throw stacks:

    public class GWindow : GameWindow
        public GWindow(int width, int height, GraphicsMode gm, string title) :base(width, height, gm, title) { }
        public override void OnUpdateFrame(UpdateFrameEventArgs e)
            if(IsExiting==false) Exit();
. GWindow window= ...create window
    window.Run(); // exits right away

Thanks :)