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

Author Topic: [SOLVED] General question: RenderTarget/~Texture/~Window and Views  (Read 3226 times)

0 Members and 1 Guest are viewing this topic.

sb

  • Newbie
  • *
  • Posts: 22
    • View Profile
Hey there.

Until now, I used a RenderWindow to draw my scene and manually moved it by applying a transition to the scene (which inherits from Drawable). However, apparently SFML provides the View class.

Now I wonder what kind of RenderTarget I should pick to draw my whole, possibly very large scene. RenderWindow seems to be unfit as this seems to be supposed not to be bigger than an actual display screen. Now there's also the RenderTarget base class and a RenderTexture class. I really can't figure out what to pick! I also think that there must be kind of a GPU limit to the dimensions.

If that's important: I draw into a Qt window and the only way to integrate I know is https://github.com/SFML/SFML/wiki/Tutorial%3A-Integrating-SFML-into-Qt , which uses a RenderWindow object.
« Last Edit: July 22, 2016, 04:24:49 pm by sb »

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
Re: General question: RenderTarget/~Texture/~Window and Views
« Reply #1 on: July 21, 2016, 05:26:21 pm »
To my knowledge, RenderWindow has no bounds, so you can render objects outside of the window, they will just not be displayed. Then move the View there, update it and then they will be displayed.

this topic talks a bit about it on the second reply (http://en.sfml-dev.org/forums/index.php?topic=17846.0)

so id just use RenderWindow as normal :) (i do this in my current project without any problems. all my items can move "out of bounds" as there are none. the View then just follows the "target" even at negative x and y coordinates.
string message = "some random dude";
cout << "I'm just " << message;

sb

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: General question: RenderTarget/~Texture/~Window and Views
« Reply #2 on: July 22, 2016, 04:23:58 pm »
Thank you for your reply.

It seems you're right. Some time before I made a mistake and scaled the RenderWindow to the size of  the scene which caused Windows 7 to change display settings or something like this, but apparently, this is neither required nor a good idea.

I tried to set up a big scene and as long as I only draw objects that lie inside the RenderWindow's View, I don't have any problems or experience bad performance.

GameBear

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
    • Email
Re: [SOLVED] General question: RenderTarget/~Texture/~Window and Views
« Reply #3 on: July 22, 2016, 06:09:30 pm »
I'm glad to be of help.

I'm pretty new myself, so I'd cant answer anything about the scaling of renderwindows- other than toggle fullscreen.

that said, if your screen is bigger than the render window, there is no need to render the stuff outside of it.

say your view is 600 by 400 pixels, with a center of 500 by 100 (render window coordinates)
then before rendering an object, make a test:
if(_x > view.getPosition().x - 300
&& _x <  view.getPosition().x + 200
&& _y > view.getPosition().y - 300
&& _y <  view.getPosition().y + 200) {
then render }

else don't!

this will save a lot of render power...

(300 and 200 should maybe be a bit bigger so things just of the edge is still rendered, also this size should be dynamic so it fits other views (300 should be view.getSize().x/2 and 200 should be the dame for .y instead :) )

do i make sense or do i ramble?
string message = "some random dude";
cout << "I'm just " << message;

 

anything