Archived

This topic is now archived and is closed to further replies.

Ziphnor

Depth testing and 2d programs

Recommended Posts

Im making a 2d game using SDL and OpenGL. I have the projection set using glOrtho, so there is no perspective. Im planning to use the depth testing available in OpenGL to avoid sorting GUI components and sprites etc before drawing them(for example normally you want to draw a sprite at (10,10) in front of the one at (10,0) assuming (0,0) being top left and y positive downwards, thus you would have to sort the sprites before drawing them). Implementing this is simple(in the sprites case just setting the depth to -y of the sprite)but is depth testing always hardware accelerated?(pardon my ignorance

Share this post


Link to post
Share on other sites
There should be no difference in hardware acceleration between ortho and perspective projections, so depth-testing should still work. Make sure your depth values in the glOrtho call are valid though.


Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

Share this post


Link to post
Share on other sites