1
Graphics / Multiple layers + multiple atlases
« on: February 06, 2013, 10:07:20 pm »
Assumptions & requirements:
So the question is as follows:
The solution I would choose is:
It seems efficient and clean for me, but AFAIK there is no support for Z-order in sfml. Is there any other efficient way of rendering sprites in this scenario, or I am left with just iteratively drawing sprites basing on their draw order?
- max texture size that can be expected (on most machines) is at least 1k * 1k (while my very old ATI Mobility Radeon HD 3400 can handle 8k * 8k...)
- every sprite will be of 64 * 64 size
- there will be more than 256 sprites
- more than one texture might be required while rendering
- sprites will be grouped logically (one texture for units, other for tiles, etc.)
- large number of sprites will be rendered on the screen every frame
- in order to run efficiently least number of context switches is required, thus least number of texture changes
- isometric projection (or at least impression of it) will be used
- iso. proj. (IP) requires to draw sprites in very ordered fashion (column-major-like order)
So the question is as follows:
How to efficiently render sprites which are on different textures?
The solution I would choose is:
- Draw static backgrounds to off-screen texture (RenderTexture) and forget about them
- Assign a Z-order to every sprite basing in what order the drawing has to be done
- Group all vertices of all rendered sprites by their textures and push them to VBO (VertexArray?)
- Issue draw calls for every VBO + Texture pair
- Let the logical draw ordering be handled by Z buffer
It seems efficient and clean for me, but AFAIK there is no support for Z-order in sfml. Is there any other efficient way of rendering sprites in this scenario, or I am left with just iteratively drawing sprites basing on their draw order?