wglCreateContextAttribsARB INVALID_OPERATION

Finally I’ve called wglCreateContextAttribsARB, but glGetError returns me INVALID_OPERATION. Anyone knowns why?



int[] mContextAttrib = new int[] {
  Wgl.WGL_CONTEXT_MAJOR_VERSION_ARB,3,
  Wgl.WGL_CONTEXT_MINOR_VERSION_ARB,2,
  Wgl.WGL_CONTEXT_PROFILE_MASK_ARB, (int)(Wgl.WGL_CONTEXT_CORE_PROFILE_BIT_ARB),
  Wgl.WGL_CONTEXT_FLAGS_ARB, (int)(Wgl.WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB),
  0
};

// Store device context handle
mDeviceContext = devctx;

// Create rendering context
if ((mRenderContext = Wgl.CreateContextAttrib(mDeviceContext, IntPtr.Zero, mContextAttrib)) == IntPtr.Zero)
  throw new Exception("unable to create context");
Debug.Assert(RenderContext.CheckErrors() == true);

CheckErrors calls glGetError, which returns the error code. Every entry point is obtained using wglGetProcAddress…

I’ve the lastest NV driver, and OpenGL implementation version is 3.2.0…

glGetError returns INVALID OPERATION untill I make current the context.

Then it works perfectly.