PDA

View Full Version : Drawing in Front buffer deosn't work



mehdi
08-19-2003, 08:05 AM
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.

rgpc
08-19-2003, 04:51 PM
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.