Currently i am programming my own 3D Engine from scratch. I know the DS supports openGL but it’s more fun and really interesting to make your own. This will probably also help me understand other things in openGL later.

D-pad to rotate around the x and y axis. L and R to rotate around the z axis.
The way this 3DEngine works is by using sinus, cosinus and tangent.

As seen in figure 1 a 3d world has 3 axes. X is to either side. Y is up or down. And Z is depth.
I have drawn a cube at the 3 axes.(yea my drawing skills rocks!) and on figure 2 you can see what the cube would look like from above. The red X’s marks a “point” in our cube.
I have drawn a circle around the edges of the cubes as the radius to all the points are the same in this case.
To rotate something we first have to know the radius so we can multiply our later coordinates with this.
Using simple trigonometry we know that in a right triangle a^2+b^2=c^2. In this case x and z are our sides and the radius is our hypotenuse.
You would think that the side z should be y. But this is not the case if you look at figure 1 and imagine this cube seen from above.
To find the radius we use x^2+z^2=radius^2. We would like to remove the exponentiation from our radius so we instead use sqaureroot(x^2+z^2)=radius.
Now we have to find out the angle the point/points are at right now. The angle between x and our radius/hypotenuse.
Using trigonometry again we know that tangent(angle)=opposite/adjacent. Instead we can use the inverse function of tangent also known as atan.
So inverse tangent(opposite/adjacent)=angle.
atan(z/x)=the angle between x and hypotenuse.
Lets say the angle were 45 we will just add how many degrees we want to rotate our points.
Now to find the coordinates in a circle you use sin(angle) for the y-coordinates and cos(angle) for the x-coordinates.
In this case X is just X in our circle. And Z is Y in our circle. So to find our NEW x and z values we use z=sin(50)*radius and x=cos(50)*radius
And thats how it works
In this example i explained how to rotate around the Y-axis. To rotate around the others you can use the same method looking at figure 3.
If you want to try out what i have made so far, you can download my .nds here:
http://www.mediafire.com/?nvmmzimjhfm