Cinder EGL Linux Problem

Hi

I need EGL for a project on linux and tried to compile cinder with es3 support.
After adding the if ! defined around the debug parameters in RendererGlLinuxGlfw.cpp as seen below - I was able to compile Cinder with the following cmake .. -DCINDER_TARGET_GL=es3

#if ! defined( CINDER_GL_ES )
	platformData->mDebug = mRenderer->getOptions().getDebug();
	platformData->mDebugLogSeverity = mRenderer->getOptions().getDebugLogSeverity();
	platformData->mDebugBreakSeverity = mRenderer->getOptions().getDebugBreakSeverity();
	platformData->mObjectTracking = mRenderer->getOptions().getObjectTracking();
#endif

But when I try to compile the BasicApp example with cmake .. -DCINDER_TARGET_GL=es3 - I get the following errors about GLX not being defined:

/usr/bin/cmake -E cmake_link_script CMakeFiles/BasicApp.dir/link.txt --verbose=1
/usr/bin/c++   -g   CMakeFiles/BasicApp.dir/home/debian/Cinder/samples/BasicApp/src/BasicApp.cpp.o  -o Debug/BasicApp/BasicApp  -L/usr/lib/gcc/x86_64-linux-gnu/6 -rdynamic /home/debian/Cinder/lib/linux/x86_64/es3/Debug/libcinder.a -lX11 -lXext -lXcursor -lXinerama -lXrandr -lXi -lEGL -lGLESv2 -lz -lcurl -lfontconfig -lpulse -lmpg123 -lsndfile -lgobject-2.0 -lglib-2.0 -lgstreamer-1.0 -lgstbase-1.0 -lgstapp-1.0 -lgstvideo-1.0 -lgstgl-1.0 /home/debian/Cinder/lib/linux/x86_64//libboost_system.a /home/debian/Cinder/lib/linux/x86_64//libboost_filesystem.a -ldl -lpthread 
/home/debian/Cinder/lib/linux/x86_64/es3/Debug/libcinder.a(x11_init.c.o): In function `_glfwPlatformTerminate':
/home/debian/Cinder/src/glfw/src/x11_init.c:808: undefined reference to `_glfwTerminateGLX'
/home/debian/Cinder/lib/linux/x86_64/es3/Debug/libcinder.a(x11_window.c.o): In function `_glfwPlatformCreateWindow':
/home/debian/Cinder/src/glfw/src/x11_window.c:1555: undefined reference to `_glfwInitGLX'
/home/debian/Cinder/src/glfw/src/x11_window.c:1557: undefined reference to `_glfwChooseVisualGLX'
/home/debian/Cinder/src/glfw/src/x11_window.c:1576: undefined reference to `_glfwCreateContextGLX'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
CMakeFiles/BasicApp.dir/build.make:115: recipe for target 'Debug/BasicApp/BasicApp' failed
make[2]: *** [Debug/BasicApp/BasicApp] Error 1
make[2]: Leaving directory '/home/debian/Cinder/samples/BasicApp/proj/cmake/build'
CMakeFiles/Makefile2:70: recipe for target 'CMakeFiles/BasicApp.dir/all' failed
make[1]: *** [CMakeFiles/BasicApp.dir/all] Error 2
make[1]: Leaving directory '/home/debian/Cinder/samples/BasicApp/proj/cmake/build'
Makefile:86: recipe for target 'all' failed
make: *** [all] Error 2

I did however manage to get a clean GLFW example running with a EGL window.

Any pointers are welcome.

Hi Tobias,

can you try rebuilding Cinder after adding the following here :

${CINDER_SRC_DIR}/glfw/src/glx_context.c

It seems like it has been missed in the case of GLES.

Cheers,
Petros

Hi Petros

Yep that did the trick - I also had to add a glfwWindowHint to enable EGL - I’m preparing a pull request for the changes I had to make… Also some of the glfw macros used are deprecated…

Thanks!

Hi all,

I’m on Odroid XU4, Ubuntu 16.04.3, trying to get -DCINDER_TARGET_GL=es3 working too.
I tried out the above, but no success. I didn’t figure out what to do with glfwWindowHint though, so maybe I’ll keenly await that pull request.

Runtime error is:

Rendering with OpenGL ES 3.0
(glfw:error): error=65542, desc=GLX: GLX extension not found
gl_es_load entered...
gl_es_2_0_ext_load: SUCCESSFUL! | 91 procs loaded
gl_es_3_0_load: SUCCESSFUL! | 104 procs loaded
gl_es_load: SUCCESSFUL
getStockShader error: VERTEX:
 1: #version 300 es
 2: uniform mat4 ciModelViewProjection;
 3: in vec4      ciPosition;
 4: in vec4        ciColor;
 5: out lowp vec4  Color;
 6: void main( void )
 7: {
 8:     gl_Position = ciModelViewProjection * ciPosition;
 9:     Color = ciColor;
10: }
11:

[1]    13414 segmentation fault  Debug/PROJECT/PROJECT

The default OGL does work, but performs poorly and maxes out the 8 cpu cores on a basic simple app.

I’ve created a pull request for fixing this.
https://github.com/cinder/Cinder/pull/1943

1 Like

That works great, thanks!