alito's picture

System.DllNotFoundException libGL.so.1 in libGLES20 application

Hi everybody, I have a problem with a OPENGLES20 application. I have developed an application for opengles in mono with opentk, and when I run this with an emulator in my pc it's fine, but when I try to run in my linux embedded I get the following error (see code). Why the application is searching for libGL.so.1? and why not libGLESv2.so.1? I try to configure OpenTk.dll.config but I get the same error.
Can somebody help me?

 Unhandled Exception: System.DllNotFoundException: libGL.so.1
  at (wrapper managed-to-native) OpenTK.Platform.X11.Glx:ChooseFBConfig (intptr,int,int[],int&)
  at OpenTK.Platform.X11.X11GraphicsMode.SelectVisualUsingFBConfig (ColorFormat color, Int32 depth, Int32 stencil, Int32 samples, ColorFormat accum, Int32 buffers, Boolean stereo) [0x00000] in <filename unknown>:0 
  at OpenTK.Platform.X11.X11GraphicsMode.SelectGraphicsMode (ColorFormat color, Int32 depth, Int32 stencil, Int32 samples, ColorFormat accum, Int32 buffers, Boolean stereo) [0x00000] in <filename unknown>:0 
  at OpenTK.Graphics.GraphicsMode.LazySelectGraphicsMode () [0x00000] in <filename unknown>:0 
  at OpenTK.Graphics.GraphicsMode.get_Stencil () [0x00000] in <filename unknown>:0 
  at OpenTK.Graphics.GraphicsMode..ctor (ColorFormat color, Int32 depth) [0x00000] in <filename unknown>:0 
  at test1.SimpleES20Window..ctor () [0x00000] in <filename unknown>:0 
  at test1.MainClass.Main () [0x00000] in <filename unknown>:0

Comments

Comment viewing options

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

It is using GLX to query available display modes but GLX is not available in your system (which makes sense, given it's an embedded system). Can you please run your application with a debug version of OpenTK.dll, compiled on Mono? (Type xbuild OpenTK.sln /p:Configuration=Debug or use MonoDevelop)

Please copy OpenTK.mdb along with your application - this should give the exact line number that causes the error.

My guess is that the platform detection code is failing and is trying to use GLX instead of EGL. I do not have access to any embedded systems so these codepaths have received little testing outside of emulators. The issues should be fixable however.

GuillermoGarces's picture

Hi, we solved this problem (I'm working with alito).

Solution was to change in X11Factory the IGraphicsMode.

Instead of returning glx graphics mode now we return egl graphics mode.

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

GuillermoGarces's picture

Now we have another error. (after changing the returned graphics mode to EglGraphicsMode)

On line 140 on OpenTK.Platform.X11.X11GLNative
we have

Functions.XGetVisualInfo(window.Display, XVisualInfoMask.ID, ref info, out dummy), typeof(XVisualInfo)

that is returning null.
and then

var result = Functions.XGetVisualInfo(window.Display, XVisualInfoMask.ID, ref info, out dummy);
window.VisualInfo = (XVisualInfo)Marshal.PtrToStructure(result, typeof(XVisualInfo));

the PtrToStructure throws an ArgumentNullException.

Note: We are testing everything in two enviroments:
* linux (Ubuntu) in an embedded system
* linux (Ubuntu) running on a VMware machine with an OPenGLES 2.0 emulator.

This last error we have it in both enviroments