PDA

View Full Version : Clearing a part of the window



Mukund
03-29-2010, 06:48 PM
Hello everyone..
Im very new to OpenGl..Im sorry, this question sound trivial..But i really need ur help..

How can i clear only a part of the graphics window??
I changed the viewport to that required area and tried clearing it..it did not work..

Bsically i want to clear it so as to display text info..ie display text,clear that part display some other info..
Pls help..
Thanks in advance.

glfreak
03-29-2010, 08:54 PM
You have to swap the buffers wglSwapBuffers after cleaning each viewport...as with rendering.

glavatar
03-30-2010, 02:08 AM
Check this wiky regard the multiple viewports:
http://www.opengl.org/wiki/Viewing_and_T...e_same_scene.3F (http://www.opengl.org/wiki/Viewing_and_Transformations#How_can_I_draw_more_th an_one_view_of_the_same_scene.3F)


The reference to scrissor function is here:
http://www.opengl.org/sdk/docs/man/xhtml/glScissor.xml

Try to put the two commands before invoke glClear(...)
glScissor(x, y, width, height);
glEnable(GL_SCISSOR_TEST);

Mukund
03-30-2010, 06:56 PM
Its still not working..I gave glClear() after giving glScissor()..

This is what im doing.Pls tell me if im right..


glScissor(500, 500, 70, 20);
glEnable(GL_SCISSOR_TEST);
glClearColor(1.0,1.0,1.0,0.0);
glClear(GL_COLOR_BUFFER_BIT);

What im doing is basically a graphics editor..
So i display "help" regarding some drawing tool and then when the cursor goes on another tool,the "help" info is changed wrt the new tool.So im required to clear only that small part of the window where the help is being displayed..How can i do this??