View Full Version : glClear (GL_COLOR_BUFFER_BIT)

06-18-2006, 07:51 PM
How to clear a portion of an OpenGL window ?

1) Create window of size 512x256.
2) glClear(GL_COLOR_BUFFER_BIT), I suppose it clears the entire 512x256 area.
3) Now how to clear only portion of the window ([0, 256]x[0, 256]) without drawing a dummy quad and set its color to glColorf(0, 0, 0); ?

Does glClear(GL_COLOR_BUFFER_BIT) clears the entire 512x256 region irrespective of the glViewport(0, 0, 256, 256) ?

06-18-2006, 08:12 PM
Hi there!

Please see the man pages for glScissor:

and glClear:

Use glScissor to limit the clear to a sub rectangle of the current viewport.