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

Author Topic: RenderTexture won't clear properly  (Read 32635 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
Re: RenderTexture won't clear properly
« Reply #15 on: October 09, 2012, 08:15:18 pm »
Try downloading http://www.songho.ca/opengl/files/fbo.zip and running the executable and see if it runs "as expected". It uses FBOs and if SFML didn't screw up and is also using the FBO RenderTexture implementation as opposed to the default then this should be able to confirm whether it is a problem related to FBO clearing. Too bad SFML has no way of checking what implementation it is using... or maybe I just didn't look hard enough.
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: 32504
    • View Profile
    • SFML's website
    • Email
Re: RenderTexture won't clear properly
« Reply #16 on: October 10, 2012, 08:15:23 am »
Quote
Too bad SFML has no way of checking what implementation it is using...
Since this would be useful only for advanced debugging in very specific cases, it probably doesn't deserve a dedicated public API. Just compile SFML from sources and put a breakpoint on the code that chooses the implementation.
Laurent Gomila - SFML developer

Zapfyr

  • Newbie
  • *
  • Posts: 29
    • View Profile
    • Email
Re: RenderTexture won't clear properly
« Reply #17 on: October 10, 2012, 08:28:16 am »
Quote
Try downloading http://www.songho.ca/opengl/files/fbo.zip and running the executable and see if it runs "as expected"

It runs as expected.

I will try to run my project on my other computer with an Nvidia 580 GTX graphics card as soon as possible and report back the results.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: RenderTexture won't clear properly
« Reply #18 on: October 10, 2012, 10:42:32 am »
Quote
It runs as expected.
Ok, so somehow SFML doesn't use FBOs the same way as this demo.

Here is an OpenGL-only version of what sf::RenderTexture does internally:
http://en.sfml-dev.org/forums/index.php?topic=9149.msg61891#msg61891

Maybe you can find the difference by testing and comparing these two programs.
Laurent Gomila - SFML developer

Daddi

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
    • http://foxdev.de/
    • Email
Re: RenderTexture won't clear properly
« Reply #19 on: October 21, 2012, 12:58:46 am »
This is the results of running your code:


I am running the AMD Catalyst 12.8 drivers, which is the current version.

I get the same results using the SFML 2.0 RC.
Graphicscard is also an AMD, but its a 6950.

When it occured within my project i thought it were my fault, but it seems to be a more general problem.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: RenderTexture won't clear properly
« Reply #20 on: October 21, 2012, 09:45:52 am »
Quote
I get the same results using the SFML 2.0 RC.
What about the latest sources?
Laurent Gomila - SFML developer

ZackTheHuman

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: RenderTexture won't clear properly
« Reply #21 on: March 02, 2013, 06:21:16 pm »
Sorry to resurrect this thread from last year, but I'm having the same experience with RenderTexture not clearing.

Hardware: AMD Radeon 6950
Software Driver Version: 13.1

I'm building SFML from source in Windows 7, I forked SFML from 38da3f4338e3b2b11e3dff2726a62104cf27fa73 and have made no modifications to the source.

I ran the sample program that renders a red square with the same results at Zapfyr.

Any ideas? Is there anything I can do to help dig into this problem?
Project Hikari Dev Blog: http://hikari.zackthehuman.com/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: RenderTexture won't clear properly
« Reply #22 on: March 02, 2013, 09:52:01 pm »
Can you explain the problem again please? I don't feel like reading the whole conversation to find out what you want ;)
Laurent Gomila - SFML developer

ZackTheHuman

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: RenderTexture won't clear properly
« Reply #23 on: March 02, 2013, 10:09:06 pm »
The issue I am experiencing is that calls to RenderTexture::clear are not actually clearing the texture. Since I draw everything to a texture this causes a problem unless I draw enough to cover the entire screen.
Project Hikari Dev Blog: http://hikari.zackthehuman.com/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: RenderTexture won't clear properly
« Reply #24 on: March 02, 2013, 10:31:54 pm »
Have you tried to investigate with the hints given in this thread?
Laurent Gomila - SFML developer

ZackTheHuman

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: RenderTexture won't clear properly
« Reply #25 on: March 02, 2013, 11:18:29 pm »
Yes, I noticed the issue in my application first, but I also tried the sample application on page 1 with the same results as the OP.

Edit: As in the OP's experience, drawing to a RenderWindow, for example, works as expected. The screen is cleared every frame. Drawing to a RenderTexture, however, does not work as expected and I see only repaints of the things that change (almost like a dirty rectangle drawing strategy).

When I run the sample application I see the same thing as the OP sees, namely a bunch of red quads instead of only one.

Edit 2: It also seems to be hardware-specific because i tried the same application on my other machine and it is working as expected; the screen is cleared each frame. The other machine has Intel integrated graphics but I don't remember the specifics.
« Last Edit: March 03, 2013, 01:58:56 am by ZackTheHuman »
Project Hikari Dev Blog: http://hikari.zackthehuman.com/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: RenderTexture won't clear properly
« Reply #26 on: March 03, 2013, 08:45:21 am »
And what about this?

Quote
Quote
Try downloading http://www.songho.ca/opengl/files/fbo.zip and running the executable and see if it runs "as expected"

It runs as expected.
Quote
Ok, so somehow SFML doesn't use FBOs the same way as this demo.

Here is an OpenGL-only version of what sf::RenderTexture does internally:
http://en.sfml-dev.org/forums/index.php?topic=9149.msg61891#msg61891

Maybe you can find the difference by testing and comparing these two programs.
Laurent Gomila - SFML developer

ZackTheHuman

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: RenderTexture won't clear properly
« Reply #27 on: March 03, 2013, 08:52:00 am »
The application from http://www.songho.ca/opengl/files/fbo.zip runs as expected, switching FBO on and off shows no difference in functionality. The teapot is drawn rotating on each face of the cube and the screen is cleared each frame.

I haven't run the OpenGL-only version of the code -- what is the expected outcome? I will run it tomorrow when I have a chance and report my findings.
Project Hikari Dev Blog: http://hikari.zackthehuman.com/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: RenderTexture won't clear properly
« Reply #28 on: March 03, 2013, 08:54:58 am »
Quote
what is the expected outcome?
A white window.
Laurent Gomila - SFML developer

ZackTheHuman

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: RenderTexture won't clear properly
« Reply #29 on: March 04, 2013, 03:25:56 am »
Ok, the compiled program from the source provided at http://en.sfml-dev.org/forums/index.php?topic=9149.msg61891#msg61891 is working as expected; it exits with a return value of 0.
Project Hikari Dev Blog: http://hikari.zackthehuman.com/blog/