Use only EGL/Disabling GLX calls


Hi there,

I come from here, and one of the paths I found in order to make my issue work is to simply avoid using GLX.

I don’t want to get into too much detail about the environment to keep it a relatively simple question but, I’m working in an iMX6 based module that doesn’t have GLX (and does not offer support whatsoever from NXP to grant GLX), however, the applications I compiled using its SDK tries to make calls to it intead of using the available EGL option. And therefore I find the following error when trying to execute it:

root@apalis-imx6:~# ./polygonExample 
[ error ] ofAppGLFWWindow: 65542: GLX: OpenGL ES requested but GLX_EXT_create_context_es2_profile is unavailable
[ error ] ofAppGLFWWindow: couldn't create GLFW window
polygonExample: /usr/src/debug/glfw3/3.2-r0/git/src/window.c:411: glfwWindowShouldClose: Assertion `window != NULL' failed.
polygonExample: /usr/src/debug/glfw3/3.2-r0/git/src/window.c:420: glfwSetWindowShouldClose: Assertion `window != NULL' failed.
Aborted (core dumped)

I couldn’t find anything in the documentation from OF or GLFW but the following snippet:

On Unix-like systems using the X Window System, the Xlib API is used for window and input management, and GLX or EGL to create OpenGL and OpenGL ES contexts.

but when compiling my application and GLFW (from Cmake) I did not find any option about not choosing GLX at all.

For more details about the general issue, please check the initial post.
I’m keeping this post to the particular question of:

Is it possible to only use EGL and avoid using GLX at all in a X11 system?

Thanks and regards,

"couldn't create GLFW window" when cross-compiling for iMX6

Finally I solved the issue. It was exactly this and it was so easy that what pains me most is that nobody could say/suggest this in 2 weeks.

Instead of using ofSetupOpenGL() without any windows parameters (i.e, ofSetupOpenGL(1024,768, OF_WINDOW)), you pass a ofAppEGLWindow to it. Which basically leaves the simplest code as:

#include "ofMain.h"
#include "ofApp.h"
#include "ofAppEGLWindow.h"
int main( ){
    ofAppEGLWindow w;
    ofSetupOpenGL(&w,1024,768, OF_WINDOW);
    ofRunApp( new ofApp());	

As a request, please document this a little bit better if possible :slight_smile: