(OpenGL) wglCreateContext () context version

I want to know which version of wglCreateContext () will return to me. Will it always return a higher version? Do you have any official links to the documentation?

+3


source to share


2 answers


You need to use wglCreatContextAttribsARB (...)

from extension: WGL_ARB_create_context .

Something like this:

    // Request an OpenGL 3.3 context
    const GLuint attribs [] = { WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
                                WGL_CONTEXT_MINOR_VERSION_ARB, 3,
                                0 };

    HGLRC hRC = wglCreateContextAttribsARB (hDC, 0, attribs);

      

Ironically, this means creating an OpenGL context, loading that extension, destroying the original context, and creating a new one by calling wglCreateContextAttribsARB (...)

. See Extension Specification. I have listed for more details.




When this extension is supported, the call

    wglCreateContext (hdc)

      

This is equivalent to calling

    wglCreateContextAttribsARB (hdc, 0, NULL)

      

+4


source


No, it is not defined. If you want any guarantees, you need to request a specific version.



You can usually count on a compatibility profile due to the need for legacy support.

+1


source







All Articles