Hi, I have a list of polygons stored in a HashSet.
I start with int depth = 0;
I add the polygons in one at a time. Each time I add a polygon i increase the depth.
Set<Polygon> polygons = new HashSet<Polygon();
int depth = 0;
public void AddPolygon(Polygon p)
Because I am using a hashset, the polygons are obviously unordered. I want it this way. I only want rendering to be ordered. (Smallest depth rendered first)
in my render method I:
1. Enable depth testing
2. Loop through and draw all polygons
3. Disable depth testing
The problem is, some polygons are rendered out of order even though their depths are right.
Is there some setting I have missed, or something I am doing wrong?