Linked Questions

Popular Questions

Where does -0.0 come from in a vertex buffer?

Asked by At

This is more a question of curiosity. I came across this problem where I was testing for the direction a triangle was facing by checking its normal. In one case, even though I knew the shape was facing right, the test always returned false. The test was performed using triangleNormal.equals(~Constant for right facing normal~).

It turned out that in this one case, the z-value for the normal for this triangle was (-1.0, 0.0, -0.0). My constant is (-1.0, 0.0, 0.0). I set the normals explicitly in a buffer and I checked and rechecked and nowhere was I setting anything to -0.0. Has anyone experienced this before? Where would -0.0 come from and how does it even exist?

Related Questions