double-buffering and initial screen

Hi, I’m posting this not to ask a question , but to tell everyone something they might have a problem with.
It’s about using double-buffering in your program and to clear the screen initially.
In my case, using double-buffering used to work for my paint program only when i painted something on the screen. The initial screen was always a background of the windows environment I was in (that’s confusing for a novice- he would have no idea of whether his program works or not.)
The I started thinking in terms of buffers, and this is where I hit upon the idea of clearing the screen (one buffer now), swap the buffers, and clear the other one.All cleared!! So the initial screen what one wanted to see is a clear screen(with just code to clear the screen, in the display-callback routine).

Probably this is one reason why guys in the universities dont write paint programs using double-buffering!!

I hope this helps certain people now.

That is because you are thinking in the old way and not now it is done in openGL.

The idea of double buffering is to not let the user see the screen until the next drawing or scene is completed and only then swap it prevent flicker.

In a traditional 2D bitmap paint program you are drawing directly to a surface buffer vs. in 3D in which everything is rendered to the surface the screen buffer.

The problem your seeing is when you swap buffers is that you draw one time on buffer A then the next time on buffer B. So some of the drawing it being stored in buffer A and then in buffer B. The correct way to draw using double buffers is to redraw the whole scene data each time.

It is not a problem to do a paint program in openGL as long as you do it in the openGL way, not with the old 2D thinking way.