Remember when we were looking at 2D graphics rendering in Chapter 2, Resource Management and 2D Graphics Rendering, I said we would be using IwGx because it would make the transition to rendering 3D graphics that much easier. Now's the time to see if my claim was true!
In this section, we shall look at how we can implement the 3D equivalent of the "Hello World" program—a spinning cube.
As with 2D rendering, the
very first thing we need to do is initialize the IwGx API by calling IwGxInit
, and of course we should call IwGxTerminate
at the end of our program.
With IwGx ready to go we next need to set up our projection. We're going to be using a perspective projection, so we need to be able to specify the perspective multiplier value that we want to use. The code to do this is as follows:
IwGxSetPerspMul((float) IwGxGetScreenWidth() * 0.5f);
This line of code sets the perspective multiplier up, to provide a 90 degree field of view...