Menu based MFC application woth Open GL??

Hi,
I want to make a frame based MFC application in which I want to show the rotating sphere.
Also I want to add some menu to change the spin direction of the sphere.

I know hoe to show it on Dialog based application.

But how to show rotating sphere by using OGL,on a frame based - menu based MFC application?

Same way as you would with any other MFC application, update some variable(s) to keep the state and use a WM_TIMER or OnIdle().

Mikael

Well, let me repost my question.
I am not able to Initalise Open GL through MFC application, though I ca do it using simple Win32 pgm.

How to Init Open GL through MFC pgm which has readymade code generated by VC++ itself ?

Plz guide.

Hi !

There is not much difference, the window that you want to render OpenGL in has a HWND handle that is the win32 handle, you can find it in the m_hWnd variable.

In OnCreate() you can use:
CClientDC dc( this);
to get a device context to use for you opengl initialization (dc.m_hDC is the handle).

And the your OnPaint method you have a pointer to a CDC class and you can get the m_hDC from that one when you want to activate you context.

The rest of the code is just ordinary win32 code so you should be able to use that.

Make sure you fetch the WM_ERASEBKGND message and return TRUE (OnEraseBkgnd) to avoid any flickering.

Mikael