go-gl / mathgl

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

mgl32.Project lacks perspective divide #60

Closed b-steiner closed 8 years ago

b-steiner commented 8 years ago

In the mgl32.Project function seems to be a perspective divide missing. See, for example, this stack overflow question: http://stackoverflow.com/questions/38471708/opengl-glm-project-method-giving-unexpected-results

Fix: Divide x,y,z by w before applying the viewport transformation

UserAB1236872 commented 8 years ago

Should be working now. I used the exact example from SO as a test case, cross-checked by feeding it into GLM.