Click to See Complete Forum and Search --> : OpenGL in a SDI


chi_luci
November 26th, 2004, 02:14 AM
can anyone provide me some simple source code on how to initialize OpenGL in a SDI view (and draw 1 line ) ?
Thanks!

Elementer
November 26th, 2004, 03:37 AM
Well, the procedure is always equal everywhere you are...
First you you must create the device context, with CClienDC *m_pDC to CView:
--
private:
ClientDC *m_pDC;
--

When the app starts:

CView::Init...()
{
m_pDC = new CClientDC(this); //create DC

//now set pixel format, create rendering context and init OpenGL

//After you can create a timer and set itself for rendering functions such this:

SetTimer(IDC_TIMER_RENDERING, 10, NULL);
}


//and set your draw function in timer function:

..OnTimer()
{
DrawMyGL();
}


//don't forget to detere the rendering context and release DC before exit...

Bye

chi_luci
November 26th, 2004, 04:38 PM
thanks.. I'm new to OpenGL . I'll try it!

smidgie
December 10th, 2004, 10:37 PM
I found the tutorials at http://nehe.gamedev.net/ to be particularly helpful in using OpenGL with the Win32 API. However, IIRC, there weren't any MFC-specific tutorials there. You might find the examples at http://pws.prserv.net/mfcogl/ to be helpful in that regard.

chi_luci
December 11th, 2004, 02:11 AM
ok, thanks..