Best way to get max SAMPLES_ARB (Antialiasing)?

Hi NG,

I´m looking for an easy way to query an OpenGL driver for the maximum supported value of WGL_SAMPLES_ARB.
This Value is used in the WGL_ARB_pixel_format extension to select the number of samples for doing Antialiasing.

The only way I see (and I dislike) is to query all available Pixelformats, that support AA and then manually search the maximum value.

It would be much cooler to be able to do (wouldn´t that be an idea g?):

glGetFloatv(GL_MAX_SAMPLES_ARB, &fMaxAASamples);
glGetFloatv(WGL_MAX_SAMPLES_ARB, &fMaxAASamples);

Anyone knows another (better) way?

By the way, if I´ve got a maximum number of 4 samples, is it sure, that I will be able to use / find a suitable Pixelformat, that has 2 samples, or can´t I assume this?


I basically have the same question.

Even worse: I don’t mind querying all the formats but what I’m seeing is that wglChoosePixelFormatARB happily claims to find pixelformats regardless of what I specifiy for WGL_SAMPLES_ARB. Or is WGL_SAMPLES_ARB only checked when I call wglCreatePbufferARB ?

These attribs pass regardless of value of max:

  addAttrib( iAttributes, WGL_SUPPORT_OPENGL_ARB,	true);
  addAttrib( iAttributes, WGL_DRAW_TO_WINDOW_ARB, true);
  addAttrib( iAttributes, WGL_RED_BITS_ARB,		8);
  addAttrib( iAttributes, WGL_GREEN_BITS_ARB,		8);
  addAttrib( iAttributes, WGL_BLUE_BITS_ARB,		8);
  addAttrib( iAttributes, WGL_ALPHA_BITS_ARB,		8);
  addAttrib( iAttributes, WGL_DOUBLE_BUFFER_ARB,  true);
  addAttrib( iAttributes, WGL_DEPTH_BITS_ARB,		16);
  addAttrib( iAttributes, WGL_SAMPLE_BUFFERS_ARB, true);
  addAttrib( iAttributes, WGL_SAMPLES_ARB,		max);

So… how do you guys check for the max number of samples?

[This message has been edited by vmh5 (edited 02-17-2004).]

OK it was a silly question…

create a format with wglChoosePixelFormatARB
with WGL_SAMPLE_BUFFERS_ARB true, then query each of those with wglGetPixelFormatAttribivARB WGL_SAMPLES_ARB