CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: OpenGL in a SDI

  1. #1
    Join Date
    Jun 2003
    Location
    Bucharest, Romania
    Posts
    529

    OpenGL in a SDI

    can anyone provide me some simple source code on how to initialize OpenGL in a SDI view (and draw 1 line ) ?
    Thanks!

  2. #2
    Join Date
    Nov 2004
    Posts
    199

    Post Re: OpenGL in a SDI

    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
    Last edited by Elementer; June 27th, 2005 at 05:51 AM.

  3. #3
    Join Date
    Jun 2003
    Location
    Bucharest, Romania
    Posts
    529

    Exclamation Re: OpenGL in a SDI

    thanks.. I'm new to OpenGL . I'll try it!

  4. #4
    Join Date
    Dec 2004
    Location
    Point Blank, TX
    Posts
    9

    Re: OpenGL in a SDI

    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.

  5. #5
    Join Date
    Jun 2003
    Location
    Bucharest, Romania
    Posts
    529

    Re: OpenGL in a SDI

    ok, thanks..
    Help me help you ... rate this article if any good!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured