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-6 The lighting example with a cube shape instead of the teapot4.4.2 Drawing both the teapot and the cubeThis example demonstrates loading and drawing two shapes:1. Use the modified code from Replacing the teapot with a cube on page 4-21 as a startingpoint.2. Modify the getSceneAsset() call to both the load the cube and teapot assets as shown inExample 4-28:Example 4-28 Load the assets for the cube and teapot.........// Loading sceneSceneAsset* scene = proxy.getSceneAsset("teapot.mba");SceneAsset* scene2 = proxy.getSceneAsset("cube.mba");GeometryAsset* cube = static_cast(scene->getAsset(Asset::TYPE_GEOMETRY, 0));GeometryAsset* teapot = static_cast(scene2->getAsset(Asset::TYPE_GEOMETRY, 0));teapot->draw();cube->draw();3. Rebuild the project and run it. Both shapes are displayed, but they overlap each other. Thelocation and size of the objects must be modified to fit them in the display area as distinctobjects.4. Modify the world-view-projection matrix and add translation and scale multiplications asshown in Example 4-29:Example 4-29 Moving the teapot and cube...wvpMatrix = proj * view * world;// scale the teapot to 70% and move it left, down, and forwardmat4 wvpMatrix_teapot = wvpMatrix *mat4::translation(-12.0, -12.0, -12.0)* mat4::scale(0.7, 0.7, 0.7);// Clear the screen and set the uniforms...teapot->draw();ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 4-22ID070710Non-Confidential - Draft - Beta

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

Saved successfully!

Ooh no, something went wrong!