• Advertisement

Archived

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

Depth testing and 2d programs

This topic is 5696 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
quote:

Make sure your depth values in the glOrtho call are valid though.



Now i feel stupid again.. What would cause the depth values to be invalid?

Share this post


Link to post
Share on other sites

  • Advertisement