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 5 of 5

Thread: Clearing the buffer

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2000
    Posts
    2

    Clearing the buffer

    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

  2. #2
    Senior Member OpenGL Pro
    Join Date
    Feb 2000
    Location
    France
    Posts
    1,118

    Re: Clearing the buffer

    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...

  3. #3
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: Clearing the buffer

    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.

  4. #4
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,527

    Re: Clearing the buffer

    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).]

  5. #5
    Junior Member Newbie
    Join Date
    Oct 2000
    Posts
    2

    Re: Clearing the buffer

    That was it! Thanks!

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

Posting Permissions

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