Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Drawing in Front buffer deosn't work

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2003
    Location
    morocco
    Posts
    15

    Drawing in Front buffer deosn't work

    hi,
    in the function MyCView::OnPaint i do:

    MyCView::OnPaint()
    {
    //we are going to draw a blue quad


    //make Rendering Context current
    ...........
    //clear with black color
    ...........

    //draw a blue quad
    glBgin(GL_QUADS)
    .......
    glEnd();

    SwapB.....;

    }




    and in MyCView::OnLButtonDown i do:
    Code:

    MyCView::OnLButtonDown(...)
    {
    //makeRendering Context current
    ...........
    glDrawBuffer(GL_FRONT);

    //draw a black quad width the same dimension in the same place as in OnPaint
    //the two quads has the same dimension

    //draw a black quad
    glBgin(GL_QUADS)
    .......
    glEnd();

    glDrawBuffer(GL_BACK);

    }

    i want clear the first(blue) quad with the second quad(black) in the front buffer but it doesn't work.
    metal & gaming

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Melbourne,Victoria,Australia
    Posts
    748

    Re: Drawing in Front buffer deosn't work

    You should keep all of your rendering in a single function (with respect to messages). ie. OnPaint

    If you draw during the "OnLButtonDown" event then chances are it is drawing, but then the next "OnPaint" is wiping out the results.

    And drawing to the back buffer sometimes, and the front buffer others will only cause you grief.

    I would recommend you have a look for some tutorials on MFC/Opengl development.

Posting Permissions

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