Mail Archives: djgpp/1997/07/13/17:49:17
Wayne Davidson writes:
> I am realively new to Allegro, as well as 3D graphics, and
>I am trying to write a program that does 3d graphics, and I don't seem
>to get the right results. I call persp_project() and it returns
>numbers that seem way off the wall, or is it that I am not using RHIDE
>correctly?.
How you use Rhide won't affect what your program does, once compiled!
> rx(0),ry(0),rz(0){x=160;y=100;z=50;}
There's a major part of the problem. The X and Y coordinates should be
zero, because the default camera is at the origin. The size of the
screen only has meaning after you've done the perspective projection
into 2d coordinates, it's not important while you are working in 3d
space...
>vertex_type points[] = /* a cube, centered on the origin */
>{
> /* vertices of the cube */
> { -32, -32,-32,
And there's the other part. You are failing to scale these numbers up
into fixed point format, so you are initialising your points with some
really _tiny_ values! Try using 32<<16 instead.
With those changes, your program works fine, except that some of the
lines run diagonally rather than along the edges of the cube. But that's
just a matter of what order you hook the vertices up in, which should be
easy to fix...
--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.
- Raw text -