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 ...
Get Expert Android now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.