11

I compiled a C++ code under Linux (Ubuntu) and everything is fine as far as I connect a monitor to my PC.

My code shows some graphics and then it saves their screenshots. The runtime graphic is not important to me but the screenshots.

But if I run the code remotely, I face with the following runtime error:

freeglut (something): failed to open display ''

If I forward x (ssh -v -X) everything would be find. But what if I don't do that?!

How to get around it? I don't care if anything is displayed or not. Is it possible to define a temporary virtual screen on the remote computer or get around this problem in any other way? I just need the screenshot files.

ar2015
  • 5,558
  • 8
  • 53
  • 110
  • I'm not entirely sure on this, but I believe that you'd want to just create the GL context without creating a window. Don't define the read/write parameters at first, create some FBOs, then set those FBOs as the read/write buffers. This way the context still has default buffers, but doesn't require a window for them. Check out [this link](https://community.khronos.org/t/offscreen-rendering-without-a-window/57842/4) – Davis Last Jul 14 '21 at 23:01
  • As far as I'm aware it's not possible to create a GL context without a window. In all the projects I've worked on it has always been necessary to have a window (hidden is possible) to create a GL context. – PeteBlackerThe3rd Aug 12 '21 at 09:16

1 Answers1

0

I suggest you try XVFD as your X server on the remote machine

Quote form this answer: Does using Xvfb to run OpenGL effects version?

Xvfb is an X server which whole purpose is to provide X11 services without having dedicated graphics hardware

This allows you to have both a GL context and a window without using a GPU

rostamn739
  • 323
  • 3
  • 8