Studying the case of isometric rendering, I'm facing a big and well-known problem : depth sorting.
After many researches it seems that without tile mapping or 'height-leveling' it's impossible to solve this problem in a 2D game.
So I imagined a depth buffer that I could use with sdl_textures . The process : each sprite would contain pixels , with rgba AND a depth variable . When it comes to blit, I would check in a backbuffer the pixels that are nearer than the current pixels and replace them. Then I would convert the buffer to a texture with only four channels (rgba without depth) in order to SDL_Rendercopy it .
My questions are:
- Is it possible to do so ?
- Isn't it too slow to check each pixel of a 1024×768 screen in this kind of scheme ?
- How do I create a sdl_texture from an simple array of int ?