News - page 7

Naming Conventions
Posted Sunday, 28 October, 2007 - 22:45 by the Fiddler.One of the nicer features of OpenTK is the use of the enumerants of the official OpenGL specs in the interface. This allows functions like GL.Enable to have an actual list of acceptable values (GL.Enums.EnableCap in this case) instead of plain constant ints, which speeds up development when using a code-completing IDE.
This feature isn't flawless however: for one, typing GL.Enums.EnableCap.DEPTH_TEST is quite a bit longer than just GL.DEPTH_TEST (less of a problem if your IDE auto-completes as you type). It would be nice if the "Enums" part could be dropped (so that you could type GL.EnableCap.DEPTH_TEST), but alas this isn't possible - several enums have the same name as OpenGL functions, resulting in clashes. Moreover, the actual specs weren't actually designed with this use in mind, so several functions, which had their specs changed throughout the years, may miss a few possible parameters (for example, TexImage2D can accept GL_BGRA as a parameter, but this is not defined in the PixelFormat enumerant).

Progress: High quality OpenGL fonts!
Posted Saturday, 20 October, 2007 - 14:52 by the Fiddler.OpenTK can now load and display truetype fonts! They are rendered with antialiasing and hinting/grid fitting if the underlying implementation supports it, and they look really really nice (see the screenshot if you don't believe me! :) )
The implementation is built on a simple idea: use the cross-platform System.Drawing namespace to render glyphs, upload them to an OpenGL texture and use it to render text. The current implementation uses display lists and requires OpenGL 1.1. I'm still working on performance (I hope to reach about 100k 32-point glyphs per second), but it is looking good already.

Progress: TexturePacker
Posted Monday, 15 October, 2007 - 12:12 by the Fiddler.The TexturePacker is a nice little tool that can pack small 2d textures inside a larger one. OpenTK will use this to pack font glyphs into video memory (see attached screenshot), but I'm considering to make it available in the public API as it can be useful in a lot of situations, like packing lightmaps, sprites or other 2d items.

Progress: Fonts and Timing
Posted Tuesday, 2 October, 2007 - 09:47 by the Fiddler.Edit: breakthrough! I've discovered a way to write a fully managed font engine, without tapping into unmanaged code. The attached screenshot shows what to expect!
After some research, I’ve abandoned the idea of using wgl/glx functions for font rendering. I want OpenTK to support for high quality bitmap and outline fonts, and the above solution simply isn’t delivering.

Careful with those pointers!
Posted Sunday, 30 September, 2007 - 13:51 by the Fiddler.Ok, I've finally tracked down the corruption problem with the Vertex Array example. It was obvious after all.
You see, when you create a Vertex Array and call GL.VertexPointer (and the rest of the family), you are supposed to keep the array data for as long as you continue to use this Vertex Array. Which is something you have to request explicitly in .Net.

OpenTK 0.3.12 released!
Posted Thursday, 27 September, 2007 - 13:16 by the Fiddler.Time for another update: download!
The last few releases contained mostly stability fixes, as well as improved WGL and GLU bindings. This one is a bit stronger on features:
- Mouse input support for GameWindow. Not perfect, but it works!
- Optimized extension loading.
- The frequency of UpdateFrame and RenderFrame calls can be set through GameWindow.Run(double updateFrequency double renderFrequency)
- GameWindow.Title property can get or set the title of the window.
- GameWindow.Unload event is raised during application shutdown, but before OpenGL context deletion. Use to unload resources.
- Two new tutorials (T02: Vertex Arrays) and (T04: Vertex Lighting) showcase the relevant OpenGL features.
- A new Test (S03: Extensions) uses reflection to obtain a list of extensions supported by your hardware.
- Documentation and interface improvements.
- Binaries released for the first time!
There are three files in this release: opentk-0.3.12.zip, opentk-0.3.12-mono.zip and opentk-0.3.12-net.zip. The first contains the source code only, which you'll have to build by hand (see the Build directory for instructions). The second two contain unsigned, optimized binaries, compiled through the Mono 1.2.5 (gmcs) and .Net 2.0 (csc) compilers, respectively.
Why release binaries? Because they are convenient, and you won't have to wait for the compiler to run though the 9.25MB worth of source files. Just add a reference, and you are ready to go.
Both binaries will run on all supported platforms, however you will get better crash reports if you use the Mono dll on Linux and the .Net dll on Windows. Apart from that, they are equivalent, bug for bug.
As always, take a look at Documentation/Release.txt for specific bug fixes and known issues. Some changes are breaking, specifically:
- GameWindow.Keyboard exposes only one Keyboard now (it used to be an IList<>). Multiple keyboard support will use a different interface.
- GameWindow.Create event is no longer fired. Applications depending on it should use the GameWindow.Load event instead.
- A few OpenGL functions had incorrectly trimmed endings (mostly 's' endings were eaten, as per GL.DrawArray vs GL.DrawArrays). Corrected now.
Don't forget to take a look at the Development section for features planned for the next release. Use the forums to ask questions and report issues.
Edit: Fixed download link...

Todo list for 0.3.12
Posted Sunday, 9 September, 2007 - 09:07 by the Fiddler.Progress: 100% complete - released
- [Done!] Speed up extension loading. OpenTK 0.3.11: ~850ms. Current: ~150ms under Linux/Mesa3d, ~550ms under Windows/Ati.
- [Done!] Mouse input with multiple mice support.
- [Done!] Add more constructors to DisplayMode class.
- [Done!] Better decouple GLContext from GLControl/GameWindow using the WindowInfo class.
- [Done!] Add cross-platform GLContext class for use in AgateLib (see below).
- [postponed] Port AgateLib to OpenTK 0.3.12. OpenTK 0.3.12 does not have fullscreen support, postponed for 0.3.13
- [Done!] Enable 'Vertex Arrays' and 'Extensions' examples. Add Lighting example.
- [Done!] Bug: Multiple keyboards detected under Windows, but all input reported from the first one.
- [Done!] Check: Is the Windows.MSG struct size correct?
- [Done!] Add Vector2, Vector3 and Vector4 structs.
- [Done!] Add timing information to UpdateFrame and RenderFrame, with support for fixed and variable time-steps.
Update 1: I've been a full week without internet connection (my router died) hence the lack of updates. I'm still working on the next release! :)
Update 2: The list above was broken on Firefox for some reason. I don't use Fx, and it worked on Opera/IE so the bug went unnoticed for quite some time. Fixed now.
Update 3: While I was at it, I updated the site layout a bit. I think it is a bit smoother now. There's also an RSS feed for OpenTK news (look above the OpenTK logo).
Update 4: I've started blocking user accounts that look like spam - send me an email if I mistakenly block a valid account! (stapostol where? gmail.com)
Update 5: I've started checking in code for OpenTK.Math. Only vector stuff for now, matrices, quaternions and random number generators will be added over the next few releases. Updated roadmap.
Update 6: GameWindow feature-creep: You can now request a fixed or variable update rate for UpdateFrame and RenderFrame (independently!). Timing information is also reported to these two functions through their EventArgs. It is now very easy to achieve framerate independence: just call GameWindow.Run(60.0, 60.0) to lock the update and render frequency at 60Hz!
Update 7: All the features I planned for this release are now complete. However, I just found out a serious bug in Mouse/Keyboard support on Linux, and the release is delayed until I manage to fix the issue. I'm also thinking to drop multiple Mouse/Keyboard support for now (and revisit this possibility after the 1.0 release).

Help Wanted page updated.
Posted Tuesday, 4 September, 2007 - 14:26 by the Fiddler.The Help Wanted page has been updated with several areas you could help develop. They range from implementation specific topics (e.g. Mac OS X support) to advanced OpenGL techniques (HDR, GLSL programs). OpenGL tutorials are especially welcome now that we are nearing the first stable release.
If you think you can help with any of these, please add a comment here, or make a post at the development forums. Thanks!

OpenTK 0.3.11 is out!
Posted Monday, 3 September, 2007 - 11:47 by the Fiddler.This release corrects many of the remaining bugs, and adds more complete GLU bindings.
- Notable changes:
- OpenTK no longer corrupts the stack under 32-bit Windows. Fixes lockups and crashes encountered on these platforms. May also correct interminent stack imbalance MDAs.
- GLControl no longer creates an OpenGL render context in design mode. Improves Visual Studio stability, memory consumption and speed.
- GLU bindings updated. All core and extension functions are included now, although not all work correctly yet (e.g. tesselator functions).
- GL bindings updated: Trailing 'v's are now trimmed (i.e. GetShaderv becomes GetShader - this is a breaking change). Allocated GCHandles are correctly released now.
- Sped up OpenGL extension loading and added timing information. The current loading method needs ~850ms under 64-bit Windows/ATI drivers (2GHz Athlon64 CPU). Linux/Mesa seems faster.
- Added new examples (but the more juicy ones are disabled - they need more work).
- Improved generator speed (GLU bindings are now generated in 5 seconds, down from 360 seconds).
I've also updated several sections of this site, and started writing the OpenTK programming manual.
All in all an important update, with little in the way of new features but with much better stability. Happy coding!

OpenTK 0.3.11 release tomorrow.
Posted Sunday, 2 September, 2007 - 14:47 by the Fiddler.Ok, the deadlock bug plaguing OpenTK has been traced to the System.Windows.Forms.Message structure. I've replaced it with the MSG implementation from Mono, and it works flawlessly now!
Among other things, I've updated the OpenGL bindings (yet again), to add function overloads missed by the generator. An annoying Mono bug, which crashed the 'T10: GLSL Cube' example, has been worked around and a couple of new examples showing basic GameWindow usage have been added. Progress on GLX has hit a snag (pointers to managed structs are not allowed), so GLX bindings will have to wait until the next release. Last but not least, I've corrected the disposable pattern implementations after reading some more material on it - the previous way did not create problems, but the new one should be faster.
All in all, 0.3.11 will be another bugfix release, which will correct almost all known bugs (including the Visual Studio crash). The next release will contain some nice new goodies - and after a year of development we are finally getting close to beta status! :)
EDIT: I just found a serious bug introduced in 0.3.10 where GCHandles are not being released. I'll be fixing this for 0.3.11, as it is quite serious!

