13.07.2015 Views

Mali GPU User Interface Engine Application Development Guide

Mali GPU User Interface Engine Application Development Guide

Mali GPU User Interface Engine Application Development Guide

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Tutorial on Drawing 3D ShapesFigure 4-5 The teapot shape with lighting effects9. Use the keyboard to change the view:• press the left or right arrows to rotate the teapot• depress the spacebar and then press the left or right arrows to move the camera• press the up arrow to change between Gouraud and Phong lighting.4.4.1 Replacing the teapot with a cubeThe advantage of using an asset in <strong>Mali</strong> Binary Asset format is that you can quickly load a newshape:1. Example 4-23 on page 4-18 showed how to load the teapot asset file. Copy the cube.mba,rock_n.png, and rock_t.png files from bumpmapping\data to the lighting\data area.The rock_n.png, and rock_t.png files are not used in this example, but they are referencedby the cube.mba file so they must also be copied.2. Modify the getSceneAsset() call to load the cube asset as shown in Example 4-27:Example 4-27 Load the asset for the teapot.........// Loading scene// SceneAsset* scene = proxy.getSceneAsset("teapot.mba");SceneAsset* scene = proxy.getSceneAsset("cube.mba");GeometryAsset* teapot = static_cast(scene->getAsset(Asset::TYPE_GEOMETRY, 0));teapot->draw();3. Rebuild the project and run it. Figure 4-6 on page 4-22 now shows a cube shape insteadof a teapot:ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 4-21ID070710Non-Confidential - Draft - Beta

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!