the Fiddler.'s picture

OpenTK 0.3.8 and the GameWindow: Milestone 1

Download now!

This is an important release in the road to beta, because a long-planned feature has been implemented: OpenTK can now directly create a render window through system calls!

Until now, the only way to create a window was to use a WinForm with an embedded opengl-capable control. While this is great for UIs, it is suboptimal for games: every single key press, mouse motion or paint event allocates memory, which hits the GC quite hard, reducing performance.

A new class, called GameWindow, was added in this release to overcome this issue. It is lightweight, it doesn't allocate memory unless absolutely needed (by taking care to reuse event arguments). It just creates an output window and provides methods for resizing, updating, rendering and closing, and while the interface it is not yet complete (mode changing and input handling do not work), it will become more fleshed in the next few releases.

Implementing this class required far reaching changes in the underlying code. The GLContext class is now a separate code module, and a new class, GLControl, was introduced to interoperate with Windows.Forms. The latter now has design-time support in Visual Studio, i.e. you can drag and drop a GLControl onto a form, hook the Resize and Paint events, and you will see 3d output inside the designer window!

Of course, All of the classes above have Windows and X11 implementations. There are still some slight differences in behavior between the two platforms, but these will be ironed in the next few releases.

Other significant changes include a change in the code layout: OpenTK is now monolithic (opengl, platform bindings, the classes mentioned above all reside in the same dll), OpenTK.OpenGL.Bind has been renamed to Bind, OpenTK.Build is now called Build and a new Examples project has been added. Although this hasn't been a big priority in 0.3.8, some new examples have been introduced to showcase the new functionality, and an example launcher that lists all of these. Expect many more in 0.3.9 (and take a look at the documentation page!).

Last, but not least, Prebuild has been updated to the latest version from svn (corrects issues with designer in VS2005), and Build.exe has been enhanced with better console output and error handling.

Download the code from Sourceforge, and take a trip to the forums to say what you think.

Happy coding!

opentk-0.3.8.jpg92.12 KB