glClear (GL_COLOR_BUFFER_BIT)

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) ?

Hi there!

Please see the man pages for glScissor:
http://www.mevis.de/opengl/glScissor.html

and glClear:
http://www.mevis.de/opengl/glClear.html

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

Regards