I'm working on an OpenGL project, coming from D3D. They're organised in very different ways, so it's tricky going :)

Is there any way for a Windows application to request a specific OpenGL context version, e.g. 2.1 or 3.x?

Also, I believe I need to use wglext.h from the OpenGL registry as the GL.h that ships with Windows is an earlier version, 1.1 or 1.4 - can anyone confirm?

  • \$\begingroup\$ The OpenGL Wiki's "Getting Started" page is a good place to... get started. \$\endgroup\$ Jun 11, 2012 at 15:32

2 Answers 2


At first, you must know that you can run a given version of OpenGL in two different profiles: Compatibility profile is supposed to be compatible with the previous versions, and Core profile which doesn't support previous versions but might be faster/smaller. There is also a forward compatibility mode, best for you is to check on OpenGL website for more details about them.

Assuming you're using wgl to create an OpenGL context and glew, here is a code snippet that gives you access to advanced options such as version and profile:

// Usual initialization
if(!wglMakeCurrent(Context->hDC, Context->hRC))
    return 0;                               


GLint attribs[] =
    // Here we ask for OpenGL 2.1
    // Uncomment this for forward compatibility mode
    // Uncomment this for Compatibility profile
    // We are using Core profile here

HGLRC CompHRC = wglCreateContextAttribsARB(Context->hDC, 0, attribs);
if (CompHRC && wglMakeCurrent(Context->hDC, CompHRC))
    Context->hRC = CompHRC;

Don't forget to include wglew.h to get access to wglCreateContextAttribsARB. If you're not using glew (or something equivalent), I think you should do, especially if you're working under Windows and want to avoid a lot of pain.


I use GL Load

then it is a simply a matter of including the version of the header you want.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .