Headless OpenGL Rendering using SSH and X11 forwarding

Richard Haney compsci2011 at gmail.com
Wed Mar 8 01:16:52 UTC 2023


Please help,

I have been going around and around with this problem but cannot seem to
make any headway. I hope that one of you OpenGL EGL experts can help. [image:
:slight_smile:]

I have created a program that uses OpenGL EGL (version 1.5) with OpenGL 3
that successfully renders an offscreen triangle and saves it to an image
file (PNG) when I ssh *without* X11 forwarding on my Linux (Ubuntu 22.04)
machine.

However when I try the same thing using ssh *with* X11 forwarding enabled I
get the following EGL error when I call eglInitialize(…): 12290 (I *think*
is EGL_BAD_ACCESS).

This seems really weird and I hope it is something simple that I am just
not currently seeing.

I really like using OpenGL with EGL but need a way to remedy this situation
if possible. Is there a way for EGL to determine if X11 forwarding is being
employed and to ignore it or some other solution?

The snippet of relevant C++ code follows, with area where error occurs
marked:

#include <iostream> #include <cstdlib> #include <EGL/egl.h> #define
EGL_EGLEXT_PROTOTYPES #define GL_GLEXT_PROTOTYPES #include <EGL/eglext.h> #
include <GL/gl.h> ... EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if(display == EGL_NO_DISPLAY) { std::cerr << "Failed to get EGL display: "
<< eglGetError() << std::endl; exit(EXIT_FAILURE); } EGLint major; EGLint
minor; if(eglInitialize(display, &major, &minor) == EGL_FALSE) { // ERROR
12290 is generated here std::cerr << "Failed to initialize EGL: " <<
eglGetError() << std::endl; exit(EXIT_FAILURE); } ...


Any help would be greatly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20230307/7da33422/attachment.htm>


More information about the mesa-dev mailing list