O'Reilly logo

Expert Android by Satya Komatineni, Dave MacLean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required