I am posting in this section because I believe the root of my issue might be in EGL and X11 in the Pi, which I am not familiar with (I am familiar with GL programming on Windows, OS X and iOS though).
I am new to the Pi and also new to the Irrlicht engine (http://irrlicht.sourceforge.net). I've been trying to compile the engine to use it with GL ES 2 on a Pi 3 running Raspbian 8, unsuccessfully. In case it matters, I am trying to do this because my ultimate goal is to run Minetest on the Pi, which is built on top of Irrlicht. And I want to run it on GL ES 2 because the alternative, the experimental desktop GL 2.1 drivers for Pi, seem to perform worse than using GL ES 2.
What I tried so far:
1. Cloned the source from here https://github.com/zaki/irrlicht
2. Ran make on the ogl-es branch. Had to do the following changes for it to compile:
a- COGLESExtensionHandler.cpp and CEGLManager.h: change #include <GLES/egl.h> to #include <EGL/egl.h>
b- -I/opt/vc/include and -L/opt/vc/lib on the Makefile.
At this point I got the engine to compile into a static lib.
I then tried making and running example01 (loads a simple model: sydney.md2). By default the example renders with the software renderer (E_DRIVER_TYPE::EDT_SOFTWARE).
This worked: it created a new window and rendered the 3d model.
I then tried recompiling and running with E_DRIVER_TYPE::EDT_OGLES2. Does not work. Fails in CEGLManager.cpp:
Code: Select all
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
EglWindow = (NativeWindowType)Data.OpenGLWin32.HWnd;
Data.OpenGLWin32.HDc = GetDC((HWND)EglWindow);
EglDisplay = eglGetDisplay((NativeDisplayType)Data.OpenGLWin32.HDc);
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
EglWindow = (NativeWindowType)Data.OpenGLLinux.X11Window;
EglDisplay = eglGetDisplay((NativeDisplayType)Data.OpenGLLinux.X11Display);
#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
EglWindow = (ANativeWindow*)Data.OGLESAndroid.Window;
EglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
#elif defined(_IRR_COMPILE_WITH_FB_DEVICE_)
EglWindow = (NativeWindowType)Data.OpenGLFB.Window;
EglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
#endif
// We must check if EGL display is valid.
if (EglDisplay == EGL_NO_DISPLAY)
{
os::Printer::log("Could not get EGL display.");
terminate();
return false;
}
I've been searching for a while online but have not found information on this. So any help would be greatly appreciated.
For comparison, I started doing some general tests of my own (without Irrlicht) and I was able to get a GL context going with EGL but without a window (eglGetDisplay(EGL_DEFAULT_DISPLAY)), so maybe this means I can't have GL ES 2 in an X11 window on Pi? Like I said, I do not have experience with it.