Overlapping polygons and Ortho

I’m using an ortho projection to make it easy to draw to the screen (ie 10 = 10 pixels). However when I try to draw two polygons that overlap each other one is pushed down and right from where is should be. So the polygons still overlap, but one is pushed down and right.

Overlapping polygons are not causing this. One polygon will not affect another.

You may have something else going on like depth testing, but I’m a bit skeptical.


Did you use matrix operations to move the polygons?

Transformations on the matrix are cumulative, you need to pushmatrix, translate, draw, then popmatrix.

Either that or loadidentity before each translate and forget the push & pop.

Depending on complexity you may want to avoid matrix manipulations for trivial stuff like single polygons.