문제

I'm trying to configure a framebuffer on a computer which has no dedicated graphics card. Only mesa GL.

I've tried multiple FB configurations but I can't seem to get a non-NULL return. The same code works on another computer with nvidia drivers..

OpenGL vendor string: Tungsten Graphics Inc
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Desktop
OpenGL version string: 3.0 Mesa 8.0.4
OpenGL shading language version string: 1.30

The mesa examples that works on another computer also fails at the same glXFBConfig line.

Here's the relevant part of the code

int fbAttribs[] = {
       None
    };

  int numberOfFramebufferConfigurations = 0;
  GLXFBConfig* fbConfigs = glXChooseFBConfig(self->display, DefaultScreen(self->display), fbAttribs, &numberOfFramebufferConfigurations);

As I said, I tried with different configurations such as:

   int fbAttribs[NUM_FB_CONFIGS][100] = {
      {
         /* Single buffered, with depth buffer */
         GLX_RENDER_TYPE, GLX_RGBA_BIT,
         GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
         GLX_RED_SIZE, 1,
         GLX_GREEN_SIZE, 1,
         GLX_BLUE_SIZE, 1,
         GLX_DEPTH_SIZE, 1,
         GLX_DOUBLEBUFFER, 0,
         GLX_STENCIL_SIZE, 0,
         None
      },
      {
         /* Double buffered, with depth buffer */
         GLX_RENDER_TYPE, GLX_RGBA_BIT,
         GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
         GLX_RED_SIZE, 1,
         GLX_GREEN_SIZE, 1,
         GLX_BLUE_SIZE, 1,
         GLX_DEPTH_SIZE, 1,
         GLX_DOUBLEBUFFER, 1,
         GLX_STENCIL_SIZE, 0,
         None
      },
      {
         /* Single buffered, without depth buffer */
         GLX_RENDER_TYPE, GLX_RGBA_BIT,
         GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
         GLX_RED_SIZE, 1,
         GLX_GREEN_SIZE, 1,
         GLX_BLUE_SIZE, 1,
         GLX_DEPTH_SIZE, 0,
         GLX_DOUBLEBUFFER, 0,
         GLX_STENCIL_SIZE, 0,
         None
      },
      {
         /* Double buffered, without depth buffer */
         GLX_RENDER_TYPE, GLX_RGBA_BIT,
         GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
               GLX_RENDER_TYPE, GLX_RGBA_BIT,
         GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
         GLX_RED_SIZE, 1,
         GLX_GREEN_SIZE, 1,
         GLX_BLUE_SIZE, 1,
         GLX_DEPTH_SIZE, 0,
         GLX_DOUBLEBUFFER, 1,
         GLX_STENCIL_SIZE, 0,
         None
      }
   };
  GLX_RED_SIZE, 1,
         GLX_GREEN_SIZE, 1,
         GLX_BLUE_SIZE, 1,
         GLX_DEPTH_SIZE, 0,
         GLX_DOUBLEBUFFER, 1,
         GLX_STENCIL_SIZE, 0,
         None
      }
   };
도움이 되었습니까?

해결책 2

Answering my own question with the solution.

This actually ended up being the OpenGL context not supporting the required extensions. In this case, I was ssh'ing (with -X) into the machine and running the binary that does all the OpenGL computation. In such cases the hosts or the client's OpenGL may be used depending on the $DISPLAY variable. Setting the DISPLAY variable to :0.0 meant use the host's OpenGL, which solved the problems.

다른 팁

Did you check, that GLX is actually available? Also for glXChooseFBConfig to work the server must support the Render extension. Both GLX and Render are widely supported these days. But they may not, so you have to check. Use glXQueryExtension to check for GLX and XRenderQueryExtension to check for Render.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top