<div dir="ltr">Hi Richard,<div><br></div><div>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?</div><div><br></div><div>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.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 8 Mar 2023 at 12:17, Richard Haney <<a href="mailto:compsci2011@gmail.com">compsci2011@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:"trebuchet ms",sans-serif"><p style="margin-top:0px;color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15.008px">Please help,</p><p style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15.008px">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.<span> </span><img title=":slight_smile:" alt=":slight_smile:" width="20" height="20" style="border-style: none; vertical-align: middle; width: 20px; height: 20px;"></p><p style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15.008px">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<span> </span>ssh<span> </span><em>without</em><span> </span>X11 forwarding on my Linux (Ubuntu 22.04) machine.</p><p style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15.008px">However when I try the same thing using<span> </span>ssh<span> </span><em>with</em><span> </span>X11 forwarding enabled I get the following EGL error when I call<span> </span>eglInitialize(…): 12290 (I<span> </span><em>think</em><span> </span>is<span> </span>EGL_BAD_ACCESS).</p><p style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15.008px">This seems really weird and I hope it is something simple that I am just not currently seeing.</p><p style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15.008px">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?</p><p style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15.008px">The snippet of relevant C++ code follows, with area where error occurs marked:</p><p style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15.008px"><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">#<span>include</span> <span><iostream></span></span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">
</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">#<span>include</span> <span><cstdlib></span></span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">
</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">#<span>include</span> <span><EGL/egl.h></span></span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">
</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">#<span>define</span> EGL_EGLEXT_PROTOTYPES</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">
</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">#<span>define</span> GL_GLEXT_PROTOTYPES</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">
</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">#<span>include</span> <span><EGL/eglext.h></span></span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">
</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">#<span>include</span> <span><GL/gl.h></span></span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">
...
EGLDisplay display = </span><span style="font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">eglGetDisplay</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">(EGL_DEFAULT_DISPLAY);
</span><span style="color:rgb(38,38,38);font-weight:bold;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">if</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">(display == EGL_NO_DISPLAY) {
std::cerr << </span><span style="font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">"Failed to get EGL display: "</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)"> << </span><span style="font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">eglGetError</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">() << std::endl;
</span><span style="font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">exit</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">(EXIT_FAILURE);
}
EGLint major;
EGLint minor;
</span><span style="color:rgb(38,38,38);font-weight:bold;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">if</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">(</span><span style="font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">eglInitialize</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">(display, &major, &minor) == EGL_FALSE) {
</span><span style="font-style:italic;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">// ERROR 12290 is generated here</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">
std::cerr << </span><span style="font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">"Failed to initialize EGL: "</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)"> << </span><span style="font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">eglGetError</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">() << std::endl;
</span><span style="font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">exit</span><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)">(EXIT_FAILURE);
}
...</span><br></p><p style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15.008px"><span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)"><br></span></p><p style="color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:15.008px">Any help would be greatly appreciated.<span style="color:rgb(38,38,38);font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace;white-space:pre-wrap;background-color:rgb(249,249,249)"><br></span></p></div></div>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Stuart Young (aka Cefiar)</div>