Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Multisample window isn't?

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2009
    Posts
    27

    Multisample window isn't?

    Hi again.

    I've created a window with GL3.2 context and I -think- I've done everything right to make it a multisampling window, however it isn't.

    Here's what I do:

    Code :
    1. Create the window, CreateWindow(...)
    2. Create a 2.1 context:
     - set PIXELFORMATDESCRIPTOR named pfd
     - int format = ChoosePixelFormat( hDC, &pfd )
     - SetPixelFormat( hDC, format, &pfd )
     - HGLRC tmpRC = wglCreateContext( hDC )
     - wglMakeCurrent( hDC, tmpRC )
    3. Initialise GLEW
    4. Ask wgl for an extended pixel format:
     int pfAttribs[] =
     {
        WGL_DRAW_TO_WINDOW_ARB, GL_TRUE,
        WGL_SUPPORT_OPENGL_ARB, GL_TRUE,
        WGL_DOUBLE_BUFFER_ARB, GL_TRUE,
        WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, GL_TRUE,
        WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
        WGL_COLOR_BITS_ARB, 32,
        WGL_DEPTH_BITS_ARB, 24,
        WGL_STENCIL_BITS_ARB, 8,
        WGL_SAMPLE_BUFFERS_ARB, 1,
        WGL_SAMPLES_ARB, 8,
        0
      };
     
      int formatEx;
      UINT numFormats = 0;
      wglChoosePixelFormatARB( hDC, pfAttribs, NULL, 1, &formatEx, &numFormats );
      if( numFormats > 0 )
        SetPixelFormat( hDC, formatEx, &pfd );
    5. Continue by creating a 3.2 context and making it current then at last show the window.
    6. In init: glEnable( GL_MULTISAMPLE )

    I've stepped through the above code and the format returned by wglChoosePixelFormatARB is 45 which, according to OpenGL Extensions Viewer is a pixel format with all the features I've requested, including WGL_SAMPLES_ARB = 8.

    Later on in the code in my GL init function I check the value of GL_SAMPLES with glGetIntegerv and it is zero, and objects are noticeably not multisampled.

    Any ideas?

  2. #2
    Junior Member Newbie
    Join Date
    Apr 2004
    Location
    Germany
    Posts
    1

    Re: Multisample window isn't?

    You can only call 'SetPixelFormat()' once per window (see remarks of http://msdn.microsoft.com/en-us/library/dd369049(VS.85).aspx). So you need to create a temp window for format enum stuff...

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2009
    Posts
    27

    Re: Multisample window isn't?

    Ah, I see. Argh, that'll mean a bit of restructuring. Oh well.

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •