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

Author Topic: RenderTexture Speed  (Read 3286 times)

0 Members and 2 Guests are viewing this topic.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
RenderTexture Speed
« on: October 09, 2011, 07:01:28 am »
Quick question: how slow is the creation of a RenderTexture? How bad would it be to create one per frame?
I use the latest build of SFML2

Disch

  • Full Member
  • ***
  • Posts: 220
    • View Profile
RenderTexture Speed
« Reply #1 on: October 09, 2011, 08:44:54 am »
It all resides in video memory so I wouldn't imagine it'd be much slower than normal rendering.

Only way to know for sure, though, would be to try it out.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
RenderTexture Speed
« Reply #2 on: October 09, 2011, 09:04:47 am »
Creating an OpenGL resource is always slow, and you should never do it every frame.

Why can't you reuse the same instance instead?
Laurent Gomila - SFML developer

Disch

  • Full Member
  • ***
  • Posts: 220
    • View Profile
RenderTexture Speed
« Reply #3 on: October 09, 2011, 04:49:34 pm »
Ah I misunderstood his question.  I thought he meant drawing to a RenderTexture, not creating it.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
RenderTexture Speed
« Reply #4 on: October 09, 2011, 07:51:11 pm »
Quote from: "Laurent"
Creating an OpenGL resource is always slow, and you should never do it every frame.

Why can't you reuse the same instance instead?
Yes, that's what I thought. Huh, I'm going to have to rethink this... I'm probably just overcomplicating it.
I use the latest build of SFML2

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
RenderTexture Speed
« Reply #5 on: October 09, 2011, 08:53:04 pm »
Like Laurent said reuse the resources instead. You can apply that everywhere you just have to be smart about it. A central manager replacing new calls is a general way to apply it but most cases don't need that.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
RenderTexture Speed
« Reply #6 on: October 09, 2011, 10:52:03 pm »
And having a rendering area with a different size every frame (I'm just guessing) doesn't mean that your render texture has to have the exact same size. It can stay larger -- just use the sprite's subrect to cut it where appropriate ;)
Laurent Gomila - SFML developer

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
RenderTexture Speed
« Reply #7 on: October 10, 2011, 12:55:59 am »
Quote from: "Laurent"
And having a rendering area with a different size every frame (I'm just guessing) doesn't mean that your render texture has to have the exact same size. It can stay larger -- just use the sprite's subrect to cut it where appropriate ;)
True... I could add that to my optimization I put in earlier (only recreate if size changes), and make it so that it only resizes if it gets larger, then use subrects... that might work! Thanks!
I use the latest build of SFML2

 

anything