PDA

View Full Version : enable multisample



robertmachardy
11-06-2009, 09:56 AM
All,

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,
Robert

overlay
11-06-2009, 01:49 PM
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:
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=46

Brolingstanz
11-07-2009, 10:14 AM
... 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).