Projected area of triangle

Started by
10 comments, last by enigmagame 16 years, 1 month ago
On how to convert the "vector" into a matrix (you haven't written how you've done it, so I mention it here): OpenGL not only uses column vectors but also column major order for their linear matrix storage. That means that a sequence of coefficients
c00 c01 c02 c03 c04 ... c15
as is returned by glGet, has to be interpreted as a matrix like in
[ c00 c04 c08 c12 }[ c01 c05 c09 c13 }[ c02 c06 c10 c14 }[ c03 c07 c11 c15 }

The algorithm you've outlined above seems me correct so far. However, there are many possibilities to build bugs into the code, of course. It may be best to check the results of the various steps for plausibility. E.g. generate a quad in front of the camera, the face perpendicular and centric to the line-of-view. Then look at the matrices when freshly returned by glGet. Do they look as expected? And after multiplying the vertex positions, are the projected positions also okay? Simplify the test cases as much as possible for the first tests, e.g. let the camera rest at 0 and don't change its looking direction. Use I as model matrix and compute the quad's vertices as they were in global co-ordinates.

I don't assume so, but it may be that the one or other matrix needs to be inverted. Looking at simplified test cases may expose such algorithmic errors earlier or later, also it may expose coding errors.
Advertisement
Ok! It runs!
Thanks!!

This topic is closed to new replies.

Advertisement