glClear and viewport

I need to draw on a particular part of the window. Setting the viewport to that part will draw the image in that part of the window but glClear still clears the whole window. How can I get glClear to clear only that portion of the window which is designated as the viewport?

Thank you!

Boyana

try glScissor() and don’t forget to enable scissor test.

What about RTFM for glClear ?
http://pyopengl.sourceforge.net/documentation/manual/glClear.3G.html

Thank you!

I tried with glScissor and glClear clears the scissor box with the given glClearColor but the whole window is still being painted with some kind of background color and all the interface (buttons, etc.) is being erased in the process. I guess I will have to update the whole window every time the rendering is being flushed out although the viewport occupies just a part of the window. Is there a way to avoid the whole window being painted every time the rendering is flushed out?

Thank you!

Boyana

What kind of framebuffer do you use - single or double buffered? In first case your task must be solved, if you use double buffering - you must redraw whole image each time you draw something…