Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Broken stuff  (Read 5649 times)

0 Members and 1 Guest are viewing this topic.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Broken stuff
« on: April 12, 2012, 09:55:57 pm »
Code: [Select]
#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 ^^.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Broken stuff
« Reply #1 on: April 12, 2012, 10:08:56 pm »
Sorry, but I don't know what's broken, and what must be fixed at line 56. Could you please explain?
Laurent Gomila - SFML developer

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Broken stuff
« Reply #2 on: April 12, 2012, 10:26:28 pm »
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?
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Broken stuff
« Reply #3 on: April 12, 2012, 10:44:14 pm »
Quote
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.

Quote
And as for L56: glDeleteRenderbuffersEXT?
Ah, I guess you're right :)
Laurent Gomila - SFML developer

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Broken stuff
« Reply #4 on: April 12, 2012, 10:54:09 pm »
Quote
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.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Broken stuff
« Reply #5 on: April 12, 2012, 11:03:08 pm »
It works as expected on my machine. What graphics card / OS / drivers do you have?
Laurent Gomila - SFML developer

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Broken stuff
« Reply #6 on: April 12, 2012, 11:09:32 pm »
AMD Radeon HD 5850 with Catalyst 12.1 on Windows 7

SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Broken stuff
« Reply #7 on: April 12, 2012, 11:12:41 pm »
Have you tested on other computers?

I'll try to test it this week-end with my AMD graphics card.

Quote
Windows 7
With a Windows 98 theme? :P
Laurent Gomila - SFML developer

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Broken stuff
« Reply #8 on: April 12, 2012, 11:22:22 pm »
Quote
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.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Broken stuff
« Reply #9 on: April 13, 2012, 08:01:35 am »
Quote
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.

Quote
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
Laurent Gomila - SFML developer

Silvah

  • Guest
Re: Broken stuff
« Reply #10 on: April 13, 2012, 06:52:23 pm »
Quote
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.

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Broken stuff
« Reply #11 on: May 11, 2012, 01:16:42 am »
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?
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Rosme

  • Full Member
  • ***
  • Posts: 169
  • Proud member of the shoe club
    • View Profile
    • Code-Concept
Re: Broken stuff
« Reply #12 on: May 11, 2012, 06:03:54 am »
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
GitHub
Code Concept
Twitter
Rosme on IRC/Discord