Somewhere in the trenches there is a little branch called 'windowing', where a major battle has taken place: one of system calls and p/invokes, exceptions and segmentation faults. It was not easy, having to tackle 64bit compatibility issues, race conditions and memory corruption at the same time, with few indications as to what was wrong, and fewer tools to help debug.
But the battle was won! The new GameWindow class creates a render window in a cross-platform manner, through p/invoked system calls. It still needs some work on event handling, but things are looking good already: see the attached screenshots!
The ultimate goal, inspired by an anonymous post on the forums, is to allow windows to be created through means other than Windows.Forms. I'm hoping to provide three methods in OpenTK itself:
- The GameWindow, a thin wrapper over the Operating System functionality, with three implementations: Windows, Linux (X11) and Mac OS X. Simple and to the point, it offers the highest performance and is most suitable for games.
- The GLControl, child of a Windows.Forms.UserControl, which allows OpenGL rendering inside a Form. It comes in Windows and X11 (Linux, Mac OS X) flavours, and has a higher memory and cpu overhead than GameWindow. On the other hand, it supports drag & drop design functionality in Visual Studio making it very suitable for user interfaces (3d/map editors and more).
- The GLWidget, the GTK# equivalent of a GLControl.
The windowing code itself is separate from both context handling and the GL class. This improves code reuse, and enables OpenTK users to add support for other windowing toolkits as needed.
Work is continuing on 0.3.8, which will be an important milestone in OpenTK development. Quite a lot of code has been refactored, many bugs have been fixed (enabling support for x64 Linux), and the X11 bindings have been extended. The build system has been further refined (faster and stabler), and the code layout has been simplified.
As always, if you have any comments, bugs to report, or features to suggest, head over at the forums and make a post. No registration required.
|GameWindow on x64 Linux.png||66.55 KB|
|GameWindow on x64 Windows.png||53.99 KB|