1
Graphics / Re: [SFML 2.0] sf::View TextBox
« on: August 08, 2013, 11:04:30 pm »Indeed, setting the viewport to the area of your text box should solve your problem.Nevermind got it.
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.
Indeed, setting the viewport to the area of your text box should solve your problem.Nevermind got it.
How can you need more textures (tilesets) than sprites (tiles)... There's at most one different texture per tile, not more.
You won't be able to draw everything in one call. Just iterate over your array of sf::VertexArray and draw them one by one using the corresponding tileset.Meaning that I need to iterate through all tilesets (500) for my map to draw? Or do I completely miss the point here.
No, because you obviously have less tilesets than tiles. Thus you have less draw calls with vertex arrays. To be more precise, if you have 50 tiles per tileset, that's 50x less calls, so approximately 50x more performant.It's not one map of 25000 different tiles but multiple maps. Every map will be loaded when needed (which can range from 10x25 or 45x10 tiles for example). The map dimensions are dynamic but tiles of different tilesets are needed for each map.
By the way, out of curiosity, what kind of map requires more than 25000 different tiles (500 tilesets * 5x10 tiles) to be loaded at the same time? It seems really huge.
Ok, I think I was not clear enough. When I say "one vertex array per texture", it implies "one draw call per vertex array". You won't be able to draw everything in one call. Just iterate over your array of sf::VertexArray and draw them one by one using the corresponding tileset.Wouldn't this be as inefficient as drawing the sprites individually?
Associate a sf::Texture and a sf::VertexArray to each tileset. Then for every tile, add a quad to the vertex array that matches the tileset. That's it.I still fail to see how this could be done in one draw call to render the entire map to the screen.
But what are these tileIDs, and what do they mean at the vertex array level? Is it just another way to refer to specific texture coordinates inside a specific tileset?Yes it is. And I have no idea how to go with it in terms of VertexArrays and a vector of tileset textures.
As I said in my first answer, you have to use one vertex array per texture. But it's still a lot better than one sprite per tile.Yeah I get this.. however I don't know how to link my tileIDs (which are loaded from a file) with those VertexArrays as each tileID could be only be used in one tileset texture.
500+ tilesets. 5 by 10 tiles (each tile is 32x32). Which is too much to cram into a single texture.QuoteNot being able to put these into one big texture as it is way too much.You still haven't said how much you would need
My situation:QuoteThe problem is putting it all in one draw call in the end.Can you be more specific about what's blocking you?
The problem is putting it all in one draw call in the end.QuoteFaced another problem, the mapdata (tileIDs) are ofcourse spread out over the tileset textures so it wouldn't be possible to use sf::VertexArrays in the first place (I think?).What problem is there? Sprites are vertex arrays internally, so if you can do it with a sprite you can do it with a vertex array.
It seems the only possible solution in my case is either drawing all tile sprites individually (bad performance)
You can avoid sf::RenderTexture, since you basically just need raw pixel copy. Use sf::Image::copy.Not sure what you mean by this. Could you elaborate?
You can't, you must have one vertex array for each tileset (texture).I suppose it's possible to put them into a bigger texture. But I'm not sure what the maximum dimensions are for sf::RenderTexture (assuming it could be done with this) as I have a lot of tilesets.
But 5x10 tiles of 32x32 is not a lot, can't you group your tilesets into a single bigger texture?