5

The OpenGL documentation for gluProject writes that the projection of point v is computed using the given projection and model-view matrix via v'' = P * M * v then window coordinates are derived using the current viewport, e.g. winZ = (v''(2) + 1)/2.

Isn't this missing the perspective division of v'' by v''(3) ? So then we should really have formulas like winZ = (v''(2)/v''(3) + 1)/2.

This agrees with my machine's opengl implementation and the implementation on the OpenGL wiki.

So, is the documentation wrong?

Alec Jacobson
  • 6,032
  • 5
  • 51
  • 88
  • I have a vague recollection of stumbling into this a few years back, but I can't find any references. – Thomas Feb 08 '14 at 14:49

1 Answers1

3

Yes, the documentation appears to be missing the divide (which is the only reason for returning GLU_FALSE, by the way). Check the mesa implementation (lines 249-252), for instance.

user3146587
  • 4,250
  • 1
  • 16
  • 25