cody's picture

OpenTK on N900

I tried to run the OpenGL ES 2.0 Example on the N900 and it doesnt work.
It cant find libGL.so.1.
When I modify OpenTK.dll.config to use libGLESv2.so instead it says that it cant find glXChooseVisual.

The N900 uses X and supports OpenGL ES 2.0.

Here is a example how to initialize it in C:
http://wiki.maemo.org/SimpleGL_example

My question is:
Is it supposed to work (perhaps with small changes) or wont it work at all?

Thanks!


Comments

Comment viewing options

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

OpenTK can use either GLX or EGL to create an OpenGL context, so the infrastructure is there and should work with only minor modifications. I don't have any mobile devices to test myself, so the best I can do is offer some advice on how to make this work (and fix any bugs that show up).

The first step is to ensure you are requesting an "Embedded" context when constructing your GameWindow (it's the last parameter of the constructor).

After that, a debug version of OpenTK.dll will print out some extra information on what it is trying to do. This would help understand why it's going for GLX instead of EGL.

cody's picture

I changed OpenTK to use the right Platformfactory, but it doesnt work yet.
Sorry I didnt know how to get the Debug Output.

Also EglX11PlatformFactory needed another override:

public override IGraphicsMode CreateGraphicsMode()
{
return new EglGraphicsMode();
}

This is one of the typical Exceptions I got:

Unhandled Exception: System.ArgumentNullException: Argument cannot be null.
Parameter name: src
at OpenTK.Platform.X11.X11GLNative..ctor (Int32 x, Int32 y, Int32 width, Int32 height, System.String title, OpenTK.Graphics.GraphicsMode mode, GameWindowFlags options, OpenTK.DisplayDevice device) [0x00000] in :0
at OpenTK.Platform.X11.X11Factory.CreateNativeWindow (Int32 x, Int32 y, Int32 width, Int32 height, System.String title, OpenTK.Graphics.GraphicsMode mode, GameWindowFlags options, OpenTK.DisplayDevice device) [0x00000] in :0
at OpenTK.NativeWindow..ctor (Int32 x, Int32 y, Int32 width, Int32 height, System.String title, GameWindowFlags options, OpenTK.Graphics.GraphicsMode mode, OpenTK.DisplayDevice device) [0x00000] in :0
at OpenTK.NativeWindow..ctor (Int32 width, Int32 height, System.String title, GameWindowFlags options, OpenTK.Graphics.GraphicsMode mode, OpenTK.DisplayDevice device) [0x00000] in :0
at OpenTK.GameWindow..ctor (Int32 width, Int32 height, OpenTK.Graphics.GraphicsMode mode, System.String title, GameWindowFlags options, OpenTK.DisplayDevice device, Int32 major, Int32 minor, GraphicsContextFlags flags, IGraphicsContext sharedContext) [0x00000] in :0
at OpenTK.GameWindow..ctor (Int32 width, Int32 height, OpenTK.Graphics.GraphicsMode mode, System.String title, GameWindowFlags options, OpenTK.DisplayDevice device, Int32 major, Int32 minor, GraphicsContextFlags flags) [0x00000] in :0
at N900.SimpleES20Window..ctor () [0x00000] in :0
at N900.SimpleES20Window.Main () [0x00000] in :0

I dont really know where this happens. I wonder where those ArgumentNullExceptions come from as I cant find them in the OpenTK code.
When I have some time I will try to give better information.

the Fiddler's picture

Thanks, that's a good start.

You can get extra debug output by compiling OpenTK in debug mode (in MonoDevelop/Visual Studio, set the configuration to "Debug" or from the commandline use "xbuild OpenTK.sln /p:Configuration=Debug").

To capture this output, add the following lines to the start of your Main() function:

using System.Diagnostics;
 
TextWriterTraceListener tl = new TextWriterTraceListener("debug.txt");
Debug.Listeners.Add(tl);

Finally, copy the debug OpenTK.dll and OpenTK.dll.mdb you just compiled from Binaries/OpenTK/Debug into your application folder. Now, your application should create a debug.txt with debug info that would help understand what is going on (please post it here).