I've been trying to create an isometric tilemap based game and got stuck for several days on sprite rendering. Just want to check with guys if my approach is even viable. Can I render everything in flat 2D quads (using x,y,z-axis) and still be able to use openGL's depth buffer to automatically sort objects based on their z-value? or must I render everything in cubes?
So far I've got the isometric maps to render correctly (in glOrthf() projection ). Each tile is rendered using a quad (x,y,z for each vertex).
For each object on map, I'm using a formula to calculate its z-value: z = -(map_width + map_height )+ (mapX + mapY), z-value is calculated based on the tile the object is sitting on. The player's z-value is updated as he moves around the map. However, my player sprite and objects are not overlapping correctly. whenever he is standing is front of an object, the top half of the player sprite gets overlapped by the object. on the other hand, when he is behind objects the image is rendered correctly.
What could be the problem? Do I need to render everything in cubes?
Thanks for any input!