Slate's picture

Using OpenTK on Mobile Device

Hello erveryone

I've run into a couple of problems trying to use OpenTK to render a application on a Windows Mobile Device. First of all, i found this project through and The Fiddler's comment about adding his Wrapper to OpenTK.

I've successfully written an OpenGL ES application using Koush's Wrapper, but encountered a small problem. Each time the scene is redrawn it flickers. As i could not get rid of the flickering, i wanted to give OpenTK a try, because The Fiddler commented on Koush's page, he had added the wrapper code to the OpenTK project.

But i have problems getting started. I seem to be incapable of getting either a GameWindow, nor a GLControl to run on Windows Mobile.

I use Visual Studio 2008 with the Windows Mobile 6 Proffessional SDK. The specific problems i'm encountering are:

  1. I can deploy the SimpleWindow20 (OpenGL ES 2.0) example to the Windows Mobile 6 Emulator, but it raises an exception at startup
    "The application failed to load required components. If the compact framework is installed on a storage card, please ensure that the card is in place..". I suspect that the GameWindow class requieres some functionality which the Compact Framework doesn't have.
  2. When trying to follow tutorial to render via a GLControl element i get stuck at the point where i have to add the GLControl Element to the Toolbox. Adding the GLControl Element to the Toolbox of an Windows Desktop Project works perfectly fine. Adding it to the Toolbox of an SmartDevice Project doesn't. In the later case it doesn't show up in the Toolbox, after adding it without errors.

Is there a simple way (or any way at all) to get OpenTK working on Windows Mobile?

Any help possible would be really appriciated


Comment viewing options

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

OpenTK cannot run on the compact framework at this time. It uses Marshal.GetDelegateForFunctionPointer extensively and this method is not supported there.

If there is enough interest, this can be fixed in the future but it is not a high priority right now.

The flickering problem sounds like a single buffering vs double buffering issue. This is very easy to solve:

  1. request a double buffered EGL context (i.e. set EGL_RENDER_BUFFER to EGL_BACK_BUFFER in the context attribute list).
  2. use eglSwapBuffers() to present the scene.
Slate's picture

Thanks a bunch :)
it wasn't actualy a double-buffer problem with open gl, as i'm using that already, but it got me started and the problem was i had forgotten to override the OnPaintBackground Method of the Windows.Forms.Form whith an empty method. That resulted in the flickering.

So simple problem and simple fix.

Thanks and keep up the good work. OpenTK wasn't the right thing for me this time, but it definitely looks promising for possible future projects.