can anyone provide me some simple source code on how to initialize OpenGL in a SDI view (and draw 1 line ) ?
Thanks!
Printable View
can anyone provide me some simple source code on how to initialize OpenGL in a SDI view (and draw 1 line ) ?
Thanks!
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
thanks.. I'm new to OpenGL . I'll try it!
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.
ok, thanks..