On Nov 24, 2007, at 1:57 AM, Paul Lalonde wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
It's hard to tell what might be wrong with your transformation if
you don't also show the transformation matrix you are using,
including the camera parameters. What you probably want is for
your transform to go from some world space coordinates (your 5,5,5)
to screen space. It's also not clear if you are expecting device
coordinates (0..1023, 0..767) or normalized coordinates (0..1,
0..1). Your resulting coordinates aren't too far off for some
camera vaguely pointing at the origin and a device coordinate
transformation matrix.
Paul
I was using no transformation matrix. I'm also thinking I'm getting
the screen width and height wrong. Either way, there are formulae in
the middle of that article, reproduced here:
.EQ
x sub { 2d } -> x sub { 3d } * { N over z } + { { screenwidth } over 2 }
.EN
.EQ
y sub { 2d } -> y sub { 3d } * { N over z } + { { screenwidth } over 2 }
.EN
It also says at the top that z=N and because equivalence is
bidirectional that N=z. I do expect device coordinates.
I remember a while back about a discussion on 3D graphics
programming. Andrey said that OpenGL was ported a long time ago but
was never tied to rio or 8 1/2. He also said that it would be doable
but difficult via APE. Unfortunately, I don't know how to program
OpenGL, and by the code I've seen to produce a single object in a
display I'm afraid of approaching it. I was hoping my simple point
conversion mechanism would light a spark. Guess I'll try again later :-)