SFML community forums

Help => Graphics => Topic started by: hilnius on October 28, 2012, 02:48:43 am

Title: [SOLVED] Very long rendering C-SFML / CAML-LIGHT
Post by: hilnius on October 28, 2012, 02:48:43 am
Hi,
Im using the CSFML binding and caml-light on a project, and i'd like to know whi it takes 0.3 seconds to render 12*18=216 sprites.
if this update time is normal then how to update just a part of the window ?

thanks
hilnius
Title: Re: Very long rendering C-SFML / CAML-LIGHT
Post by: hilnius on October 28, 2012, 07:22:46 pm
finallt, that was something stupid : i'm running on a VM that does not use my graphic card.
Title: Re: [SOLVED] Very long rendering C-SFML / CAML-LIGHT
Post by: 7krs on October 28, 2012, 11:20:02 pm
how to update just a part of the window ?

Well I found that you can update just part of the window by simply drawing over it without clearing:
You could basically "clear" parts using sf::RectangleShape or even sf::CircleShape of your desired size and colour.

EDIT: read Laurent's comments in the posts beneath. This method is "not reliable".
Title: Re: [SOLVED] Very long rendering C-SFML / CAML-LIGHT
Post by: Laurent on October 29, 2012, 07:58:19 am
Quote
Well I found that you can update just part of the window by simply drawing over it without clearing:
You could basically "clear" parts using sf::RectangleShape or even sf::CircleShape of your desired size and colour.
Wrong. Never do that ;)
Title: Re: [SOLVED] Very long rendering C-SFML / CAML-LIGHT
Post by: 7krs on October 29, 2012, 09:49:43 am
But why Laurent? It worked for me and I never got any memleaks, could you explain why it is wrong to do so?
Title: Re: [SOLVED] Very long rendering C-SFML / CAML-LIGHT
Post by: Laurent on October 29, 2012, 10:08:47 am
You shouldn't expect pixels rendered previously to be valid in the current frame. For example, with double-buffering, you would get the pixels rendered two frames ago.

It might work in certain circumstances, but it's not clean/reliable. And it's not necessary.