Drawing order.

Started by
3 comments, last by ahlywog 13 years, 4 months ago
How important is the order in which you draw you objects to your scene? Should they be drawn in a certain order?
Advertisement
For opaque objects. The draw order is importatant for cutting down on the amount of overdraw. This is important if you have expensive shaders. You want to draw the objects near the front first, so that they have a chance to occlude the stuff behind. For transparent objects, the order is oposite. To get proper blending, you have to draw transparent objects from back to front, after all the opaque things.
So opaque: Closest to the camera to the farthest.
Transparent: Farthest from the camera to the closest?

Does OGL determine this automatically or is this something I need to manage?
No, opengl draws things in the order you give it, it doesn't sort it for you.

For opaque objects it isn't critical to do this, but it can hurt your performance if you're drawing hundreds of things behind other objects.

For transparency if you want physically correct transparency you need to manually draw things back to front.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
Alright I figured that might be the case.

Any good tuts out there on sorting object lists before rendering?

This topic is closed to new replies.

Advertisement