[SOLVED] Z order best practise

Hi gurus :slight_smile:

I was wondering what the advice was when it comes to Z order to avoid tearing. When testing my game on some machines I so far found one (running OpenGL 1.4 on an integrated intel card) that had problems with my z order so the textures ended up inside each other.

My current use is to first draw the ground and then draw things on top of it at (ground z+0.02). This works perfectly well in all cases but one. If the z value is really close to the camera it still works, but when the z value gets further from the camera it doesn’t work anymore (I guess that the 0.02 is too small a part when z is 20 smaller than the camera but when it is 3 it works fine).

Any ideas? What is the best solution for it when you want to have it run on intel integrated cards?

Thanks a ton in advance,
Mickelukas

glPolygonOffset(float factor, float units)

Short but nice answer :wink:

I was pretty much doing that already but with my own offset function. I’ll use the OpenGL one and test it on the old computer :slight_smile:

Thanks!

I read somewhere that using polygon offset has a performance hit but I didn’t notice anything.

I implemented it and it worked like a charm on the old integrated intel card.

Thanks!