SFML community forums
General => General discussions => Topic started by: binary1248 on April 12, 2012, 09:55:57 pm
-
#include <SFML/Graphics.hpp>
int main() {
sf::RenderWindow app_window( sf::VideoMode( 400, 300 ), "Ghost Square" );
sf::RenderTexture render_texture;
render_texture.create( 400, 300 );
while ( app_window.isOpen() ) {
sf::Event event;
while ( app_window.pollEvent( event ) ) {
if ( event.type == sf::Event::Closed ) {
app_window.close();
}
}
render_texture.draw( sf::RectangleShape( sf::Vector2f( 200, 200 ) ) );
render_texture.display();
render_texture.clear();
// Just to be sure.
render_texture.display();
// The RenderTexture SHOULD BE cleared to black here right?
render_texture.draw( sf::RectangleShape( sf::Vector2f( 100, 100 ) ) );
render_texture.display();
app_window.clear();
sf::Sprite sprite;
sprite.setTexture( render_texture.getTexture() );
app_window.draw( sprite );
app_window.display();
}
return EXIT_SUCCESS;
}
Hopefully it is obvious what is broken.
And at the same time you can fix https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/RenderTextureImplFBO.cpp#L56, c&p error I guess ^^.
-
Sorry, but I don't know what's broken, and what must be fixed at line 56. Could you please explain?
-
According to doc render_texture.clear(); should clear the color buffer to the color (black by default) set. Running render_texture.clear(); does not get rid of the white square. It is still there although I clear AFTER drawing the square.
And as for L56: glDeleteRenderbuffersEXT?
-
According to doc render_texture.clear(); should clear the color buffer to the color (black by default) set. Running render_texture.clear(); does not get rid of the white square. It is still there although I clear AFTER drawing the square.
No, you also draw a square after clearing.
And as for L56: glDeleteRenderbuffersEXT?
Ah, I guess you're right :)
-
According to doc render_texture.clear(); should clear the color buffer to the color (black by default) set. Running render_texture.clear(); does not get rid of the white square. It is still there although I clear AFTER drawing the square.
No, you also draw a square after clearing.
Yeah a smaller square... on top of the bigger one. That SHOULD produce a clean white square on a black background, however it does not. If you comment that out you will notice the bigger one still lingering there by itself.
-
It works as expected on my machine. What graphics card / OS / drivers do you have?
-
AMD Radeon HD 5850 with Catalyst 12.1 on Windows 7
(http://img696.imageshack.us/img696/2338/ghostb.png) (http://imageshack.us/photo/my-images/696/ghostb.png/)
-
Have you tested on other computers?
I'll try to test it this week-end with my AMD graphics card.
Windows 7
With a Windows 98 theme? :P
-
Windows 7
With a Windows 98 theme? :P
You make it sound like it's something bad... I am a Linux user too btw. ^^ an ArchLinux user... on openbox.
-
You make it sound like it's something bad...
It's just strange to decide to use a 14 year old window theme, instead of just keeping the default one which looks much better.
I am a Linux user too btw. ^^ an ArchLinux user... on openbox.
I don't know OpenBox but from what I've read that could explain your choice ;D
-
You make it sound like it's something bad...
It's just strange to decide to use a 14 year old window theme, instead of just keeping the default one which looks much better.
It's equally strange to decide to use a new window theme that happens to be the default, instead of changing it to an old and trustworthy one which looks much better :P
You know, de gustibus non est disputandum.
-
So.... after reviewing the commits from the last month I didn't notice glDeleteRenderbuffersEXT getting fixed.. and did you get around to test it on your AMD card?
-
I get something similar with a convexshape(triangle). If I change the position of the triangle, I get two triangle. And if I move it again, I get three, etc. I found that if I draw something after with a direct call to a window.draw(), so no sf::RenderTexture, it fixed the problem for some reason.
My video card is an AMD Radeon HD 6850