Sign in to follow this  
Guardanapitcho

Draw without clean the buffer

Recommended Posts

Hello. I wrote an application that simulates a double pendulum, and I want to draw it's path on the screen. The problem is: If I don't clean the buffer, the pendulum will "multiply", appearing all over the screen.
So, basically, I need to clean the [b]pendulum[/b] but not the [b]path[/b].
I thought of storing all the points of the path and draw it at every clean, but I guess it's not a nice way to do it.
So, I thought of drawing the pendulum in a "layer" and the path in another one. But there is a way to do it? If not, what do you suggest me to do?

Thanks

cleaning* Edited by Guardanapitcho

Share this post


Link to post
Share on other sites
[quote name='Guardanapitcho' timestamp='1313937174' post='4851908']
So, I thought of drawing the pendulum in a "layer" and the path in another one. But there is a way to do it? If not, what do you suggest me to do?
[/quote]

You could create a rendertarget which receives the draw call for the path every frame without being cleared, then begin rendering to the backbuffer with a normal clear, but then restore the content of the rendertarget so it fills the background, then draw the entire pendulum.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this