How to clear part of screen

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to clear part of screen

Irene Tang
Hi,
I  used right mouse click and move to draw a rectangle dynamically, and left mouse click and move to rotate the 3D graphics. If I have drawn a 3D graphics , then right mouse click and move to draw a rectangle, then rotate the 3D graphics, that rectangle would disappear because I use glClear() to clear the whole screen before I redraw the 3D graphics. What should I do if I want to keep the rectangle?
Reply | Threaded
Open this post in threaded view
|

Re: How to clear part of screen

elect
How do you draw the rectangle?
Reply | Threaded
Open this post in threaded view
|

Re: How to clear part of screen

Irene Tang
I was intended to draw a rectangle but it's too hard. So I changed to a cylinder
Reply | Threaded
Open this post in threaded view
|

Re: How to clear part of screen

Irene Tang
In reply to this post by elect
 The blue is a cylinder drawn by right mouse click and move. If I rotate the 3D graphics using left mouse click and move, the blue cylinder will disappear.
Reply | Threaded
Open this post in threaded view
|

Re: How to clear part of screen

elect
Ok, but how do you draw it exactly? You create a VBO and render it?
Reply | Threaded
Open this post in threaded view
|

Re: How to clear part of screen

Irene Tang
No, I used glut.glutSolidCylinder(radius, distance, 32, 32);
Reply | Threaded
Open this post in threaded view
|

Re: How to clear part of screen

elect
Well, you need to call that function each frame/display() call then

Although you should draw it in your own since that's deprecated. Rendering a square is relatively easy, we can help you if you need