Appendix 1: Frequently asked questions
[General Questions]
- What is the Open Toolkit exactly?
The Open Toolkit is a C# library that:- allows .Net programs to access OpenGL, OpenAL and OpenCL
- abstracts away the platform-specific code for window creation, input devices, and
- provides helper functions (math, fonts, etc)
As such, is roughly analogous to SlimDX, SDL or GLFW.
- Is OpenTK limited to games?
No! OpenTK can be - and has been - used in scientific visualizations, VR, modeling/CAD software and other projects. - What is the difference between OpenTK and the Tao framework?
The Tao framework tries to follow the unmanaged APIs as closely as possible. OpenTK, on the other hand, takes advantage of .Net features like function overloading, strong-typing and generics. Consider the following code snippet:// OpenTK.Graphics code: GL.Begin(BeginMode.Points); GL.Color3(Color.Yellow); GL.Vertex3(Vector3.Up); GL.End();
// Tao.OpenGl code: Gl.glBegin(Gl.GL_POINTS); Gl.glColor3ub(255, 255, 0); Gl.glVertex3f(0, 1, 0); Gl.glEnd();
The code is trivial, but it illustrates the difference nicely: OpenTK removes unecessary cruft ('gl', 'ub', 'f'), uses strongly-typed enums ('BeginMode') and integrates better with .Net ('Color').
There are other differences not so readily apparent: OpenTK will not allow you to pass invalid data to OpenGL (wrong tokens or non-valuetype data); it plays better with intellisense (inline documentation, overloads, strong-types); it checks for OpenGL errors automatically in debug builds.
All these become more important as a project grows in size.
- Will my Tao project run on OpenTK?
Starting with version 0.9.9-2, OpenTK is compatible with Tao.OpenGl, Tao.OpenAl and Tao.Platform.Windows.SimpleOpenGlControl. Simply replace your Tao.OpenGl, Tao.OpenAl and Tao.Platform.Windows references with OpenTK and OpenTK.Compatibility and your project will as before, while gaining advantage of all OpenTK features. - OpenGL is not object-oriented. Does OpenTK change that?
No, the Open Toolkit mirrors the raw OpenGL API. This was a conscious design decision, to avoid introducing artificial limitations. However, users have contributed object-oriented libraries built on top of OpenTK - check out the project database. - I care about speed. Is OpenTK slow?
No, OpenTK introduces minimal overhead over raw OpenGL. However, do note that the underlying runtimes (.Net/Mono) introduce some unique performance considerations - refer to our documentation for more information. Performance is always a concern, so please report an issue if you believe something could run faster. - Which platforms does OpenTK run on?
OpenTK is primarily tested on Windows, Linux and Mac OS X, but is also known to work on Solaris and *BSD variants. All features work across platform without recompilation.
A lighter version is also made available for the iPhone through the MonoTouch project (recompilation required). There is no official support for Windows Mobile or Android at this point. - Is OpenTK safe to use? How mature is it?
OpenTK is considered safe for general use. It is being used successfully by both free and commercial projects and the library is under active development, with regular bugfix and feature releases.
[Windows.Forms & GLControl Questions]
- How can I make my Form fullscreen?
Use the following code snippet:myForm.TopMost = true; myForm.FormBorderStyle = FormBorderStyle.None; myForm.WindowState = FormWindowState.Maximized;
- My GLControl.Load event isn't fired.
Please upgrade to OpenTK 0.9.9-4 or newer. - How do I use stencil, antialiasing or OpenGL 3.x with GLControl?
Create a custom control that inherits from GLControl:class CustomGLControl : GLControl { // 32bpp color, 24bpp z-depth, 8bpp stencil and 4x antialiasing // OpenGL version is major=3, minor=0 public CustomGLControl() : base(new GraphicsMode(32, 24, 8, 4), 3, 0, GraphicsContextFlags.ForwardCompatible) { } }
[Graphics questions]
- How can I save a screenshot?
Refer to the "How to save an OpenGL rendering to disk" section in the documentation.
- Printer-friendly version
- Login or register to post comments

