Switching Views

Hello All,
I have two OpenGL views in my MFC app. I switch back and forth with a button. The problem is that on execution, the SetPixelFormat(hDC, …) call in the SetWindowPixelFormat function in the second view prevents the drawing in my first view. I have to change the size so an OnSize call is made, then the drawing appears. Anyone know how to prevent this?
Thanx in advance.

Hi, Link19, I have got exactly the same problem. I have 2 MFC views, both are customized for use with OpenGL. Before I customize the second view, the first view is working smoothly. However, after customizing the second view, both views can only display the background, and when I resize the window, the drawing appears. Have you solved the problems?

Hi, I have solved the problem now. It is due to the fact that I haven’t called wglMakeCurrent(…) everytime before drawing anything on the view.

Ive already called wglMakeCurrent(…) before i draw in my view, so that isnt my problem. Ive had help in another forum, but havnt attempted the solution yet. Anyway, here’s the advice i received:
When do you select the OpenGL rendering context?
You can only have one selected at a time, no matter how many windows you have.
Therefore, if you select the context when the window is created all the drawing from both of your windows will be created in the last window to be created.
To overcome this problem, you will need to make sure you select and deselect the appropriate RC every time you draw.