The following contains a set of tutorial ports and tutorials of me regarding the Android development.
Apron Android Ports
This tutorial port introduces something important for every 3D application: Shadows. With the help of the stencil buffer you get to draw the shadow of a cube, illuminate by a dynamic light source on a textured floor.
The tutorial source code resembles the structure laid out in the NeHe Ports. Therefore, if you know these you will easily understand the structure and find the changes. The Cube, Light and the Floor classes are just object representations and nearly the same to the NeHe ports. The interesting things are in the StencilShadow class, especially in the OpenGL drawing function and below. In the drawing function you will find the procedures enabling to only draw to the stencil buffer and back. By enabling and drawing the objects to it we draw shadows. How the shadow has to look like is given in the function beneath. It calculates the shadow matrix to draw from the light source.
Changes regarding the original: The changes to the original are that this is a merged tutorial of the Apron with the NeHe basic class structure. Basically the port resembles NeHe, but the drawing logic is taken from Apron into the StencilShadow class.
Controls: The controls are similar to the NeHe ones but converted from the original tutorial to the Touchscreen. What you can do is alter the light source position all by moving on the touchscreen. The directions to move the light source (x, y and z) are represented by areas on the screen. The controls are:
- Upper Touchscreen: Move the light on the x-axis (left and right)
- Left Touchscreen: Move the light on the z-axis (back and forth)
- Rest of the Touchscreen: Move the light on the y-axis (up and down)
…more to come…
I hope some of the things posted here can help you during development. If you like it, have questions, are mad at me or you have ideas for improvement, please let me know. The comments are open!