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

Author Topic: RenderTarget* to RenderTexture, can't display()  (Read 3150 times)

0 Members and 1 Guest are viewing this topic.

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
RenderTarget* to RenderTexture, can't display()
« on: June 16, 2018, 05:03:17 pm »
My art assets are "native" to 1080p resolution which means if I'm going to offer other popular resolutions such as 900p or 768p, I have to adjust the view and use the setsmooth function on textures; otherwise everything looks like jagged crap.

I did that, then I noticed that sf::Text can't be smoothed the same way textures are. Instead I decided to draw everything on a RenderTexture and smooth that instead. Works perfectly.

Then it dawned on me that if the game will be run in 1080p, there's no need to do any of this. So, in order to save a draw call and the creation of a large texture, I tried this:
sf::RenderWindow Window;
sf::RenderTarget* ptrRenderTarget;
sf::RenderTexture RT;

if (Resolution == 1080p) { ptrRenderTarget = &Window; }

else { ptrRenderTarget = &RT; }
 
When I do this, I can clear and draw to the RenderTexture via RenderTarget pointer BUT I can't call display().

Is this whole idea redundant? Should I just always use the RenderTexture?

If this is actually a good idea, then how do I call display? What if I don't call it?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: RenderTarget* to RenderTexture, can't display()
« Reply #1 on: June 16, 2018, 06:31:28 pm »
I don't think it is relevant to optimize your game for only a certain part of your users, because you'll have to make it run smoothly for all the others (that use the RT) anyway.

Regarding your question about display(), it has already been discussed on this forum, even recently.
Laurent Gomila - SFML developer

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: RenderTarget* to RenderTexture, can't display()
« Reply #2 on: June 17, 2018, 04:35:53 pm »
Is there any other way to smooth text when you change view size? An equivalent of the set smooth function for textures?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: RenderTarget* to RenderTexture, can't display()
« Reply #3 on: June 18, 2018, 06:37:16 am »
sf::Font's textures are already smoothed.
Laurent Gomila - SFML developer

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: RenderTarget* to RenderTexture, can't display()
« Reply #4 on: June 18, 2018, 06:54:53 pm »
Doesn't look smooth

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: RenderTarget* to RenderTexture, can't display()
« Reply #5 on: June 18, 2018, 07:21:05 pm »
Might have something to do with this: https://github.com/SFML/SFML/pull/1452
Laurent Gomila - SFML developer

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: RenderTarget* to RenderTexture, can't display()
« Reply #6 on: June 18, 2018, 07:38:53 pm »
All right, thanks. I will be using unadjusted views for texts then.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: RenderTarget* to RenderTexture, can't display()
« Reply #7 on: June 19, 2018, 06:34:52 am »
I mean that font smoothing was disabled by accident and enabled again only very recently. So if you're using SFML 2.5 then you may want to try the latest master.

(sorry, I didn't have time to elaborate in my previous reply)
Laurent Gomila - SFML developer

NGM88

  • Full Member
  • ***
  • Posts: 162
    • View Profile
Re: RenderTarget* to RenderTexture, can't display()
« Reply #8 on: June 19, 2018, 07:36:22 am »
Oh, OK.

(edit) Actually is there an easier way to re-enable it without having to compile the latest build with cmake? Or a Visual C++ 14 (2015) - 32-bit package for that build?

--

Also a related problem with text (see attachment)

text spaces are messed up
« Last Edit: June 19, 2018, 08:53:36 am by NGM88 »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: RenderTarget* to RenderTexture, can't display()
« Reply #9 on: June 20, 2018, 11:44:46 am »
Not yet, but once it's merged you can get a build for that configuration from the CI server.
Laurent Gomila - SFML developer