SFML community forums
Help => Graphics => Topic started by: Ashenwraith on April 10, 2010, 06:45:03 pm
-
Hi, when I worked in flash with blitting you had control over the 'clear' (fill) of each image to clean up the pixels before drawing.
Are you doing this automatically in SFML?
How do I get control of this in SFML?
-
Why clear the images?
You can clear the screen with App.Clear(), read the tutorials.
You can also clear a sf::RenderImage.
-
Why clear the images?
You can clear the screen with App.Clear(), read the tutorials.
You can also clear a sf::RenderImage.
Hi, thanks for the tips.
I'm aware of App.Clear(), that's why I used 'too'.
The question is what OpenGL/SFML does for drawing/clean up.
When you are blitting the pixels are copied into an image to give the appearance of a stack. If you don't copy clear (or bg colored) pixels into the image than it remains 'dirty'.
I haven't checked the source, but 'App.Clear()' appears to effect everything to make it easy. But I might need certain images to be 'dirty'. Maybe it's doing buffer swaps or something like that.
I'll try to look at the source, but it would be nice if there was a diagram/chart/explanation of how opengl works in SFML (it's probably different in 2.x too).
-
The question is what OpenGL/SFML does for drawing/clean up.
For cleaning up: You can have a look at RenderTarget.cpp. It calls glClear, which basically fill a color across the backbuffer.
For drawing: It uses the 3D hardware to draw a textured quad. The whole copying of pixels, rotating, scaling ... is left to the GPU.
When you are blitting the pixels are copied into an image to give the appearance of a stack. If you don't copy clear (or bg colored) pixels into the image than it remains 'dirty'.
You can choose not to call Clear. Instead, you can draw a blank image on top of the part you need to clear. However, I recommend using an sf::RenderImage
-
The question is what OpenGL/SFML does for drawing/clean up.
For cleaning up: You can have a look at RenderTarget.cpp. It calls glClear, which basically fill a color across the backbuffer.
For drawing: It uses the 3D hardware to draw a textured quad. The whole copying of pixels, rotating, scaling ... is left to the GPU.
When you are blitting the pixels are copied into an image to give the appearance of a stack. If you don't copy clear (or bg colored) pixels into the image than it remains 'dirty'.
You can choose not to call Clear. Instead, you can draw a blank image on top of the part you need to clear. However, I recommend using an sf::RenderImage
Thanks a lot. This seems to do what I need/want.
I'll have to see how it affects performance.