Headless OpenGL Rendering using SSH and X11 forwarding

Stuart Young cefiar at gmail.com
Tue Mar 14 22:47:03 UTC 2023


Hi Richard,

If your program works without X11 forwarding but doesn't work WITH X11
forwarding (on the same remote machine), then perhaps the easiest thing
might be to unset the DISPLAY variable using something like unsetenv() or
putenv() from cstdlib / stdlib.h within your program?

Of course, this assumes that you want that program to not bother with X11
output to you (remotely) at all. If that's not the case, then you'd
definitely need to look into the other methods people have described.


On Wed, 8 Mar 2023 at 12:17, Richard Haney <compsci2011 at gmail.com> wrote:

> 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.
>


-- 
Stuart Young (aka Cefiar)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20230315/cce86f07/attachment-0001.htm>


More information about the mesa-dev mailing list