Hi All,
I have a mainform with two clientforms both with a panel on it.
The panel is used to render to.
When a clientform is created I use this code to init opengl/render:
clientform0_Panel_DC := GetDC(clientform0_RenderPanel.Handle);
clientform0_Panel_RC := CreateRenderingContext(clientform0_Panel_DC, [opDoubleBuffered], 32, 24, 8, 64, 4, 0);
ActivateRenderingContext(clientform0_Panel_DC, clientform0_Panel_RC);
CreateRenderingContext sets PixelFormat and calls wglCreateContext.
ActivateRenderingContext calls wglMakeCurrent(clientform0_Panel_DC, clientform0_Panel_RC);
So far everything is fine.
Opengl renders to the panel on the clientform.
Nothing wrong here.
When I create a second clientform I call the same code as shown above but clientform0 is replaced buy clientform1.
Now Opengl renders to the second panel on clientform1.
Still nothing wrong, but when I click on clientform0 I call
wglMakeCurrent(clientform0_Panel_DC, clientform0_Panel_RC);
I expect Opengl renders to the panel on clientform0 again but instead I get an error message like ‘The pixel format is invalid’.
Any idea why I get this error?
Thanks,
Peter