go-gl / mathgl

A pure Go 3D math library.
BSD 3-Clause "New" or "Revised" License
554 stars 65 forks source link

Fix missing negative sign in Frustum #27

Closed pwaller closed 10 years ago

pwaller commented 10 years ago

This made for an interesting debugging session whilst I tried to figure out why I couldn't get anything to render :)

Unfortunately the test code had Far = 0, so didn't spot the error, since the test itself was buggy (It should be the case that 0 < Near < Far).

This fix makes it match the opengl implementation gl.Frustum.

I hope this doesn't break too much stuff in the wild!

der-antikeks commented 10 years ago

Oh... I remember that test. I just couldn't find any external examples. Therefore the comment. :unamused:

pwaller commented 10 years ago

@der-antikeks I totally missed the comment. Easily done. It now appears to work correctly and gives the same results as gl.Frustum in all cases I tried, fwiw.

dmitshur commented 10 years ago

What comment are you talking about?

pwaller commented 10 years ago

@shurcooL the // TODO: more tests