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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Ekami

Pages: [1]
1
Window / Re: Zoom on view using too much ressources
« on: July 06, 2013, 04:12:14 pm »
You actually have several problems.

Quote
The problem is that we have to redraw the whole content of the window each time we want to modify the view.

This is wrong, with SFML you must clear and redraw everything in every frame. Keeping old pixel data through frames is not the correct way to go about using SFML.

This is what we are doing actually and it's ressource consuming to clear and redraw everything in every frame for me. We did not implemented any game loop and one frame to another can be considered as a zoom in/out.

Quote
The problem we are facing is that because the views are passed by copy into our renderWindow we can not find a way to access it later or to keep a reference on it

You should read the tutorials again. To quote from the bright red section in the tutorial.

Quote
When you call setView, the render-target keeps a copy of the view, not a pointer to the original one. So whenever you update your view, you need to call setView again to apply the modifications.
Don't be afraid to copy views or to create them on the fly, they are lightweight objects (they just hold a few floats).


Your problem with resources is obviously not with views. It seems more to me that your problem comes from the number of draw calls you are sending the GPU. You should consider using a vertex array for drawing.
Exactly, there i a huge amout of draws and we are trying to avoid that. As quoted on the tutorials: "the render-target keeps a copy of the view, not a pointer to the original one". Thus we can't just get our working view back outside of our function to zoom in/out on it as it will be a copy. We have to redraw all we want to display and act on new views to zoom.
I was wondering if there is a way to draw not on our renderWindow (sf::RenderWindow) but on a sf::View for example and then pass it to the renderWindow, this way we could act on our view without redrawing the entire map at each call of our function redrawMap.

Pages: [1]
anything