1

I am trying to setup window-less OpenGL rendering. I am following these instructions for "Offscreen rendering only."

The code fails right here:

/* get framebuffer configs, any is usable (might want to add proper attribs) */
if ( !(fbc = glXChooseFBConfig(dpy, DefaultScreen(dpy), visual_attribs, &fbcount) ) ){
    fprintf(stderr, "Failed to get FBConfig\n");
    exit(1);
}

glXChooseFBConfig fails to set or retrieve a FBConfig.

I should mention that I am ssh'ing into an AWS ubuntu 12.04 machine without the -X option (should I?) I also have a VNC server running that I'm tunneling into through ssh. I have tried the accepted solution to this question, namely changing the DISPLAY env variable, but that still doesn't work:

$ export DISPLAY=:0
$ ./testglXContext
No protocol specified
No protocol specified
No protocol specified
No protocol specified
Failed to open display
$ 

What should I do?

Community
  • 1
  • 1
richizy
  • 2,002
  • 3
  • 21
  • 26
  • Don't you check that `dpy != NULL` before you ever do anything with `dpy`? – n. m. could be an AI Sep 01 '14 at 17:15
  • @n.m.: Doesn't matter AWS instances normally don't have an X server running. Without an X server no GLX. BTW, this is the second time in short succession I see you giving not just unhelpful, but actually misinformed comments or advice. Please don't post "advice" without being 100% sure you did understand the problem. – datenwolf Sep 01 '14 at 18:01
  • @datenwolf I have not given any advice to this OP, just asked a simple question about coding practices. Please be very much certain that I do understand what an AWS instance is. – n. m. could be an AI Sep 01 '14 at 18:10

1 Answers1

2

To create a GLX based context you need a X Server running. Without an X server no GLX without GLX no GLX context. Don't use ssh -X or ssh -YC because that would just route OpenGL operations to your local machine.

Note that on an AWS machine you normally don't have a full blown GPU except for GPU AWS instances; and I'm not sure you can actually run a X server on those. If you want to render off-screen can live with software OpenGL rasterizer performance you may want to look at OSMesa http://www.mesa3d.org/osmesa.html

datenwolf
  • 159,371
  • 13
  • 185
  • 298