The cube I had been rendering did not calculate for camera pitch/yaw, so if it was a 3d game you would only be able to look in the +X direction. I added some math to fix that, but then I got another problem.

I wasn't using floating point numbers, and I was using a homemade arctan table which, sadly, may have been less than accurate. The cube jumped around the screen and was recognisable only most of the time.

I was using propeller spin language, and used fixed-point arithmatic. I think its time I used c++. We shall see how it goes!

## Discussions

## Become a Hackaday.io Member

Create an account to leave a comment. Already have an account? Log In.

You don't really need arctan at all.

You can do the whole rendering pipeline with just sin and cos, and those can be computed very efficiently (and simultaneously). Of course, you also need addition, multiplication, and one division for the perspective projection. Using homogeneous coordinates really simplifies things, too.

The OpenGL transformation model is good to check out if you haven't seen it, and can look past FORTRAN-style column-major arrays :-)

http://www.songho.ca/opengl/gl_transform.html

Are you sure? yes | no

Thanks! I actually figured it out. i used the trig identity for tan(a+b), then I figured out that I could rotate the world around the camera and that made it work :D

Are you sure? yes | no