Is this the proper method for creating an OpenGL 3.3+ forward-compatible context?// Create windowWNDCLASSEX wc;ZeroMemory( &wc, sizeof( wc ) );wc.cbSize = sizeof( wc );wc.lpfnWndProc = _eventHandler;wc.hInstance = GetModuleHandle( NULL );wc.hIcon = LoadIcon( NULL, IDI_APPLICATION );wc.hIconSm = LoadIcon( NULL, IDI_APPLICATION );wc.hCursor  = LoadCursor( NULL, IDC_ARROW );wc.lpszClassName = OpenGL 3.3;if ( !RegisterClassEx( &wc ) ) Error( Failed to register window class! );if ( !( _window = CreateWindowEx( WS_EX_CLIENTEDGE, OpenGL 3.3, OpenGL 3.3, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 800, 600, NULL, NULL, GetModuleHandle( NULL ), NULL ) ) )    Error( Failed to create the window! );if ( !( _hdc = GetDC( _window ) ) ) Error( Failed to retrieve device context! );// Choose pixel formatint pixelFormat;PIXELFORMATDESCRIPTOR pfd;ZeroMemory( &pfd, sizeof( pfd ) );pfd.nSize = sizeof( pfd );pfd.nVersion = 1; pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW;  pfd.iPixelType = PFD_TYPE_RGBA; pfd.cColorBits = 32;pfd.cDepthBits = 32; pfd.iLayerType = PFD_MAIN_PLANE;if ( !( pixelFormat = ChoosePixelFormat( _hdc, &pfd ) ) ) Error( Failed to find suitable pixel format! );if ( !SetPixelFormat( _hdc, pixelFormat, &pfd ) ) Error( Failed to set pixel format! );// Create temporary context and make sure we have supportHGLRC tempContext = wglCreateContext( _hdc );if ( !tempContext ) Error( Failed to create temporary context! );if ( !wglMakeCurrent( _hdc, tempContext ) ) Error( Failed to activate temporary context! );int major, minor; glGetIntegerv( GL_MAJOR_VERSION, &major ); glGetIntegerv( GL_MINOR_VERSION, &minor );if ( major < 3 || minor < 2 ) Error( OpenGL 3.2 is not supported! );// Create forward compatible contextint attribs[] ={    WGL_CONTEXT_MAJOR_VERSION_ARB, major,    WGL_CONTEXT_MINOR_VERSION_ARB, minor,     WGL_CONTEXT_FLAGS_ARB, WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,    WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,    0};PFNWGLCREATEBUFFERREGIONARBPROC wglCreateContextAttribsARB = (PFNWGLCREATEBUFFERREGIONARBPROC)wglGetProcAddress( wglCreateContextAttribsARB );if ( !wglCreateContextAttribsARB ) Error( Failed to find pointer to wglCreateContextAttribsARB function! );if ( !( _context = wglCreateContextAttribsARB( _hdc, 0, (UINT)attribs ) ) ) Error( Failed to create forward compatible context! );// Remove temporary context and activate forward compatible contextwglMakeCurrent( NULL, NULL );wglDeleteContext( tempContext );if ( !wglMakeCurrent( _hdc, (HGLRC)_context ) ) Error( Failed to activate forward compatible context! );// Show windowShowWindow( _window, SW_SHOW );UpdateWindow( _window );It seems to work (gives GL_INVALID_OPERATION when using glBegin), but I just want to make sure this is the right way to go about it.
OpenGL forward-compatible context creation on Windows
c++
This looks right to me. I am a bit tired right now and usually use GLFW.You might be interested in this page on the OpenGL wiki describing setting up the context after 3.1 which is essentially the same work.