   wglMakeCurrent problems...
  How is wglMakeCurrent working?My rendering loop always looked like:if (wglGetCurrentContext()==NULL) wglMakeCurrent(hDC,hRC);render();SwapBuffers(hDC);And that works fine. However if I do like: wglMakeCurrent(hDC,hRC);render();SwapBuffers(hDC);It does just display a grey background (which is refreshed). Why?Recently I implemented offscreen rendering using p buffers. My loop looks like this:wglMakeCurrent(pBuffer_hDC,pBuffer_hRC);renderToBuffer();wglMakeCurrent(normal_hDC,normal_hRC);render();SwapBuffers(hDC);and this does not work either!! It displays one frame and then keeps displaying the same frame (no change).Please tell me what I am doing wrong. Thanks 
  Probably when you call MakeCurrent in the first code you use the right hDC,hRC...in the other codes you use different (and wrong) hDCs. hdc must be the same also in SwapBuffer()... My suggestion is to create an hdc and consequently an hrc in your init routine for every context (window, bitmap or pbuffer) and then use something like thisif(GetCurrentContext()!=hrc){  MakeCurrent(hdc,hrc);}//// Render//SwapBuffer(hdc);However it is said to say that in Windows and OpenGL hdcs are strange things.... ;  Thanks blizzard999,I found the problem and apologize for my stupidity:When I created the context withhRC=wglCreateContext(hDC);hRC was a local variable masking the global one! Later I used the global version of hRC which explains why it didn''t work!I have another quick question: glGetError is supposed to return the last error code and clear the last error. In my code, I activate my pbuffer with:int e0=glGetError();bool successful=wglMakeCurrent(pBuffer_hDC,pBuffer_hRC);int e1=glGetError();int e2=glGetError();The strange thing is:e0=GL_NO_ERRORsuccessful=truee1=GL_INVALID_OPERATIONe2=GL_INVALID_OPERATION1.) How can my call be successful and generate an error code at the same time?2.) Why is e2 not GL_NO_ERROR? (the error code should be cleared after the call int e1=glGetError(); )