July 2013
Intermediate to advanced
436 pages
11h 25m
English
Cube Renderer
Listing 9-57 is the code to draw a cube, texture it, and rotate it on command. Notice how simple this code is. In fact, most of the space in this class is taken by the definition of the 36 vertex points (two triangles each for each of the six surfaces) and 24 texture points.
Take a look at the code first. Following the code, we explain the crucial steps in this code.
Listing 9-57. A Controllable Spinning Cube
//filename: ES20ControlledAnimatedTexturedCubeRenderer.javapublic class ES20ControlledAnimatedTexturedCubeRendererextends ES20SingleTextureAbstractRenderer{ //A raw native buffer to hold the point coordinates for the cube. private FloatBuffer mFVertexBuffer; //A raw native buffer to hold the texture coordinates for ...
Read now
Unlock full access