enable multisample


 I am programming for a Windows environment, and I am attempting to use multisampling.  Currently, both of the following "return" 0:
glGetIntegerv(GL_SAMPLE_BUFFERS, &buffers);
glGetIntegerv(GL_SAMPLES, &samples);
 I believe this is because the pixel format descriptor I am using does not support multisampling.  How do I create a descriptor that supports multisampling?

Thank you,

You have to initialize the context throught some wgl function. The only way to have access to the wgl functions is to have an existing OpenGL context in the first place.

To sum up:

  1. create a dummy OpenGL context
  2. get access to the wgl functions to create the context with multisampling
  3. get rid of the dummy context.

Details for the context creation can be found in lesson 46 of NeHe tutorials:

… And should your hardware permit you to dabble in GL 3.2 (see TexImage2DMultisample) or extensions (see NV_explicit_multisample) you can render to multisample textures instead, which are considerably easier to setup and use but require that you resolve manually for presentation via BlitFramebuffer or shader (see e.g. sampler2DMS in the GLSL 1.5 spec).