Results 1 to 3 of 3

Thread: Opengl and MFC

  1. #1
    Member Contributor
    Join Date
    Mar 2002
    Location
    CA,USA
    Posts
    57

    Opengl and MFC

    I don't know much about MFC programming.
    But I create a single document MFC application using appwizard.
    I made following changes
    void CLineView::OnDraw(CDC* pDC)
    {
    CLineDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);
    drawline();

    }

    void CLineView::OnSize(UINT nType, int cx, int cy)
    {
    CView::OnSize(nType, cx, cy);

    // TODO: Add your message handler code here
    glViewport ( 0, 0, cx, cy ) ;
    }

    void CLineView::drawline( )
    {
    glClearColor ( 0.0f, 0.0f, 0.0f, 0.0f ) ;
    glClear ( GL_COLOR_BUFFER_BIT ) ;

    glBegin ( GL_LINES ) ;

    glColor3f ( 0.0f, 1.0f, 0.0f ) ;
    glVertex2f ( 0.25f, 0.25f ) ;
    glVertex2f ( 0.75f, 0.25f ) ;

    glEnd( ) ;

    glFlush( );
    }

    And I have declared the drawline function as public in class CLineView : public CView
    This code is simple ,but still i don't see any thing.
    I have included gl.h and in links (setting)opengl32.lib .
    What can be the problem ?

    Thanks
    aus

  2. #2

    Re: Opengl and MFC

    I can't tell where you are calling swapbuffers(), see examples at www.mfcogl.com

  3. #3
    Member Contributor
    Join Date
    Mar 2002
    Location
    CA,USA
    Posts
    57

    Re: Opengl and MFC

    Thanks for the website.
    I hadn't written setpixel function.

    Now it works


    Thanks,
    aus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean