luca-piccioni / OpenGL.Net

Modern OpenGL bindings for C#.
MIT License
568 stars 108 forks source link

RPI3: 'unable to create window surface' exception #95

Open SergeyBokhantsev opened 6 years ago

SergeyBokhantsev commented 6 years ago

I'm trying to get a VideoCore sample working on RPI 3 (Raspbian strech, mono 5.10.0.160) using latest 0.7.1 release.

When using Fake KMS driver: getting 'unable to create window surface' exception at this line https://github.com/luca-piccioni/OpenGL.Net/blob/354e0bbfd92718c847e27bf8cae3c740fe2f829f/Samples/HelloTriangle.VideoCore/Program.cs#L54

When using Full KMS driver: getting an exception 'unable to get BCM window size' at https://github.com/luca-piccioni/OpenGL.Net/blob/354e0bbfd92718c847e27bf8cae3c740fe2f829f/Samples/HelloTriangle.VideoCore/Program.cs#L49

I'm not sure if this somehow related to my system configuration. Is there some tutorial on getting this working on Raspbian?

luca-piccioni commented 6 years ago

Can you describe your execution environment? I've run the sample application on RPi2, using VC4+GLES2: note that the application does not require X11, since the VC4 library exposes a basic windowing system without any backend (just like Kodi running without X11).

Are you running under X11? Then your application must be set up just like any X11 application (GLX+GL). Probably you need to disable EGL initialization to get it work (set environment variable OPENGL_NET_EGL_STATIC_INIT to "NO").

SergeyBokhantsev commented 6 years ago

I've tried from both X11 and not. Also tried OPENGL_NET_EGL_STATIC_INIT. There were always different erros that I mostly described above. So I just started from scratch, reimaged latest raspbian Stretch, updated/upgraded etc.

The first proplem was Stretch does not have libEGL libs for some reason. I did core upgrade as per this post: https://www.raspberrypi.org/forums/viewtopic.php?t=191638

Second problem I cannot resolve is: * failed to add service - already in use Some info here: https://www.raspberrypi.org/forums/viewtopic.php?p=1239827#p1239827 and: https://raspberrypi.stackexchange.com/questions/75219/fixing-failed-to-add-service-already-in-use-error-programmatically

mode777 commented 6 years ago

Same problem here. Fixed it by adding Bcm.bcm_host_init(); at the top of the VideoCoreWindow's constructor. This call was originally wrapped in an event handler, which is never called with my setup.