Replay OpenGL OCX

I had build an Activex Control that can
plot 3D Surfaces with VC++ (Opengl) .

But When I insert the control in a vb form

and take 2 instances on the form i found

that the first instance blank where

the second is enabled .when i insert a third

one i found that the first and the second

instances blank and the third run and

so on .

Does That Problem in the double Buffer Of

OpenGL .I Mean when I use the new instance

its double buffer replaces the Old One .

The Problem is not In the gl Context because

i had create the gl Context before Drawing


just checking - do you share the context between all the windows, or do they have one each?

i had this problem a year ago. i fixed it by using the function


Because opengl acts like a state-maschine, you have to specify the window you want to render to. Go to the drawing-method of your ocx and call the function before drawing anything. This should help. For more information on using wglMakeCurrent, see msdn.

Best regards

This is because you can only have 1 current opengl context per thread. You can do the wglmakecurrent/wgldontmakecurrent trick to fix the problem, but you would have to do that in every function which uses GL.