PDA

View Full Version : Clearing the buffer



tclay
10-17-2000, 07:52 AM
Ok - WinNT 4.0 sp6, Visual C++. I have created a COpenGLWnd class, derived from CWnd. When my scene redraws (10 fps), it does not clear the previous image. I am using double buffering, and I am calling glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BITS | GL_ACCUM_BUFFER_BIT) with a glClearColor( 0, 0, 0, 0).

Any ideas as to why it is not clearing the previous image?

Thankx,
Tom

Eric
10-17-2000, 11:15 PM
Make sure your rendering context is made current before calling glClear (i.e. use wglMakeCurrent)...

Eric

P.S. : I can't see any other explanation...

Relic
10-18-2000, 06:38 AM
The correct call is glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
not GL_DEPTH_BITS. Though GL_DEPTH_BITS is defined in the gl.h for glGet functionality and therefore this compiles!

If that's not helping, make sure
- you have the glDrawBuffer set on the correct buffer,
- you have the user scissor disabled or set to the correct area, as this is one of the few calls which affect the glClear,
- you have the color maks and depth mask set correctly.

Do you need the accumulation buffer?
On most boards this is virtual memory on the host and it takes very long to clear that in comparison to the color buffer. Maybe you get much more than 10 fps.

Relic
10-18-2000, 06:44 AM
Shoot, it swallowed my previous answer...

Oh, now it's there... seems to be a problem with the proxy, here.

[This message has been edited by Relic (edited 10-18-2000).]

tclay
10-18-2000, 07:07 AM
That was it! Thanks!

My mind must have said, "Those two are close, so they must be the same."