glXChooseFBConfig && multisampling

Hi,

I can’t get multisampled default framebuffer with glXChooseFBConfig, whereas with glXChooseVisual I can.

my attrib list (used with glXChooseFBConfig) follow :

int attlist[] =
{
	GLX_FBCONFIG_ID, GLX_DONT_CARE,
	GLX_BUFFER_SIZE, 0, //not in indexed color mode
	GLX_LEVEL, 0,
	GLX_DOUBLEBUFFER, True,
	GLX_STEREO, False,
	GLX_AUX_BUFFERS, 0,
	GLX_RED_SIZE, static_cast<int>(_config.colorBuffer.r),
	GLX_GREEN_SIZE, static_cast<int>(_config.colorBuffer.g),
	GLX_BLUE_SIZE, static_cast<int>(_config.colorBuffer.b),
	GLX_ALPHA_SIZE, static_cast<int>(_config.colorBuffer.a),
	GLX_DEPTH_SIZE, static_cast<int>(_config.depthBuffer),
	GLX_STENCIL_SIZE, static_cast<int>(_config.stencilBuffer),
	GLX_ACCUM_RED_SIZE, 0,
	GLX_ACCUM_GREEN_SIZE, 0,
	GLX_ACCUM_BLUE_SIZE, 0,
	GLX_ACCUM_ALPHA_SIZE, 0,
	GLX_RENDER_TYPE, GLX_RGBA_BIT,
	GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
	GLX_X_RENDERABLE, True,
	GLX_X_VISUAL_TYPE, GLX_TRUE_COLOR,
	GLX_CONFIG_CAVEAT, GLX_NONE,
	GLX_TRANSPARENT_TYPE, GLX_NONE,
	GLX_SAMPLE_BUFFERS, (_config.samples > 1 ? 1 : 0),
	GLX_SAMPLES, (_config.samples > 1 ? static_cast<int>(_config.samples) : 0),
	None
};

And with GLX_SAMPLE_BUFFERS == 0 && GLX_SAMPLES == 0 I have only these two configs (when I look at glxinfo I see many more possible configs, and some of them multisampled) :


  Double buffer			1
  Stereo				0
  Caveat				none
  X renderable			1
  Frame buffer level		0
  Color buffer size		32
  Red buffer size			8
  Blue buffer size		8
  Green buffer size		8
  Alpha buffer size		8
  Aux buffers			4
  Depth buffer size		24
  Stencil buffer size		8
  Red Accum buffer size		16
  Blue accum buffer size		16
  Green accum buffer size		16
  Alpha accum buffer size		16
  Render mode			RGBA
  Drawable type available		window pixmap pbuffer
  Visual type available		true_color direct_color pseudo_color static_color gray_scale static_gray
  Transparent type		none
  Sample buffers			0
  Samples per fragment		0
  ------------------------------------------------------
  ------------------------------------------------------
  Double buffer			1
  Stereo				0
  Caveat				none
  X renderable			1
  Frame buffer level		0
  Color buffer size		32
  Red buffer size			8
  Blue buffer size		8
  Green buffer size		8
  Alpha buffer size		8
  Aux buffers			4
  Depth buffer size		24
  Stencil buffer size		8
  Red Accum buffer size		16
  Blue accum buffer size		16
  Green accum buffer size		16
  Alpha accum buffer size		16
  Render mode			RGBA
  Drawable type available		window pixmap pbuffer
  Visual type available		true_color direct_color pseudo_color static_color gray_scale static_gray
  Transparent type		none
  Sample buffers			0
  Samples per fragment		0
  ------------------------------------------------------

With glXChooseVisual I use this attrib list :

int attlist[] =
{
	GLX_USE_GL,
	GLX_BUFFER_SIZE, static_cast<int>(colorBufferSize),
	GLX_RGBA,
	GLX_DOUBLEBUFFER,
	GLX_RED_SIZE, static_cast<int>(_config.colorBuffer.r),
	GLX_GREEN_SIZE, static_cast<int>(_config.colorBuffer.g),
	GLX_BLUE_SIZE, static_cast<int>(_config.colorBuffer.b),
	GLX_ALPHA_SIZE, static_cast<int>(_config.colorBuffer.a),
	GLX_ACCUM_RED_SIZE, 0,
	GLX_ACCUM_GREEN_SIZE, 0,
	GLX_ACCUM_BLUE_SIZE, 0,
	GLX_ACCUM_ALPHA_SIZE, 0,
	GLX_DEPTH_SIZE, static_cast<int>(_config.depthBuffer),
	GLX_STENCIL_SIZE, static_cast<int>(_config.stencilBuffer),
	GLX_SAMPLE_BUFFERS, (_config.samples > 1 ? 1 : 0),
	GLX_SAMPLES, (_config.samples > 1 ? static_cast<int>(_config.samples) : 0),
	None
};

I’m on a geforce 9800gt with 190.38 driver (glx 1.4), on kubuntu 9.04.
Does anyone have the same problem?

Before investigating about your code, look for the available configurations with glxinfo, the first list is about GLX Visuals, the second list is about GKXFBConfigs.

Or, as you have the nVidia driver, just launch nvidia-settings and look at the list of Frame Buffer Configurations in OpenGL/GLX Information.

At least I have these FB configs (multisampled, double buffered, and r8g8b8a8) :

   visual  x  bf lv rg d st colorbuffer ax dp st accumbuffer  ms  cav
 id dep cl sp sz l  ci b ro  r  g  b  a bf th cl  r  g  b  a ns b eat
----------------------------------------------------------------------
0x8f  0 tc  0 32  0 r  y  .  8  8  8  8  4 24  0 16 16 16 16  2 1 Ncon
0x90  0 dc  0 32  0 r  y  .  8  8  8  8  4 24  0 16 16 16 16  2 1 Ncon
0x93  0 tc  0 32  0 r  y  .  8  8  8  8  4 24  0 16 16 16 16  4 1 Ncon
0x94  0 dc  0 32  0 r  y  .  8  8  8  8  4 24  0 16 16 16 16  4 1 Ncon
0x9f  0 tc  0 32  0 r  y  .  8  8  8  8  4 24  8 16 16 16 16  2 1 Ncon
0xa0  0 dc  0 32  0 r  y  .  8  8  8  8  4 24  8 16 16 16 16  2 1 Ncon
0xa3  0 tc  0 32  0 r  y  .  8  8  8  8  4 24  8 16 16 16 16  4 1 Ncon
0xa4  0 dc  0 32  0 r  y  .  8  8  8  8  4 24  8 16 16 16 16  4 1 Ncon
0xba  0 tc  0 32  0 r  y  .  8  8  8  8  4 24  0 16 16 16 16  2 1 Ncon
0xbc  0 tc  0 32  0 r  y  .  8  8  8  8  4 24  0 16 16 16 16  4 1 Ncon
0xc2  0 tc  0 32  0 r  y  .  8  8  8  8  4 24  8 16 16 16 16  2 1 Ncon
0xc4  0 tc  0 32  0 r  y  .  8  8  8  8  4 24  8 16 16 16 16  4 1 Ncon

This works on NVidia:

  static int visual_attribs[] =
    {
      GLX_X_RENDERABLE    , True,
      GLX_DRAWABLE_TYPE   , GLX_WINDOW_BIT,
      GLX_RENDER_TYPE     , GLX_RGBA_BIT,
      GLX_X_VISUAL_TYPE   , GLX_TRUE_COLOR,
      GLX_RED_SIZE        , 8,
      GLX_GREEN_SIZE      , 8,
      GLX_BLUE_SIZE       , 8,
      GLX_ALPHA_SIZE      , 8,
      GLX_DEPTH_SIZE      , 24,
      GLX_STENCIL_SIZE    , 8,
      GLX_DOUBLEBUFFER    , True,
      GLX_SAMPLE_BUFFERS  , 1,
      GLX_SAMPLES         , 4,
      None
    };

Try that and tweak from there. Don’t forget to:

glEnable( GL_MULTISAMPLE );

too to enable multisample rasterization.

In fact the problem is the Caveat flag…
All these configurations have a Ncon caveat (non conformant config)…

The glx 1.4 specification say (3.3.3 Configuration Management):

if it is set to GLX NON CONFORMANT CONFIG then rendering to a drawable with this configuration will not pass the required OpenGL conformance tests.

I read OpenGL FAQ about conformance test : http://www.opengl.org/resources/faq/technical/gettingstarted.htm#gett0160

and so, now, I have an another question, why these configurations (multisampled) are said to not pass the conformance tests?

Well, how would one test for multisample conformance?

I can understand there is no test for multisampling because the specification is not really clear about it.
But if there is no test, shouldn’t we say that this configuration is conformant?

Is there a place where I can find what is the exact missing to the conformance?