Can you try to draw how it is supposed to look?
A i see it if they were on the same level they would collide with each other.
Can you try to draw how it is supposed to look?
A i see it if they were on the same level they would collide with each other.
http://3das.noeska.com - create adventure games without programming
Yes, that's basically what I'm trying to achieve.
EDIT
Or maybe you could tell me how do I bring one sprite on front of the other once it was rendered already? Hm, maybe not the best descriptive way of telling you about the problem, that's why take a look at these two images:
http://i52.tinypic.com/2rff2bt.jpg and http://i56.tinypic.com/2d91qf9.jpg
What I mean is that no matter which sprite I choose, it's drawn on top of the other ones.
Last edited by Brainer; 26-11-2010 at 06:38 PM.
Do you have a specific reason to use depth buffer for 2D rendering? It is slower than normal and regarding your problem it would be easily solved with drawing order. When depth buffer is disabled, what sprite is drawn last will show on top of others. You can disable the buffer on the fly too to draw just that 1 sprite on top of others.
glDisable(GL_DEPTH_TEST)
A sprite is a sprite, there is no depth, so I don't follow what you are thinking of. If it were 3D then it might make some sense, but as you are working with flat 2D sprites all you can really do is 2D tricks such as blending, ADD, OR, XOR and so on.
If you want specific sprites to overlap over another then it's simply a matter of drawing order and you have to adjust that so that it is drawn last somehow. The use of a depth buffer seems like a waste of resources to do such things though.
...also, is this an iOS app I see? Very nice. Good work.
Yeah, you both were right. Using layers helped me solve the problem. Thanks a lot!
Bookmarks