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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Tutorial on Drawing 3D Shapes...{}if (keyboard->getSpecialKeyState(Keyboard::KEY_RIGHT)){world_teapot *= mat4::rotation(1.0f, vec3(0.0f, 0.0f, 1.0f));}if (keyboard->getSpecialKeyState(Keyboard::KEY_LEFT)){world_cube *= mat4::rotation(-1.0f, vec3(0.0f, 0.0f, 1.0f));}9. Modify the code that draws the shapes to use the new world-view-projections as shownin Example 4-32:Example 4-32 Independent worlds for the teapot and cube...wvpMatrix_teapot = proj * view * world_teapot* mat4::translation(0.0, 0.0,20.0);// Clear the screen and set the uniformscontext->setUniformMatrix("WORLD_VIEW_PROJECTION", wvpMatrix_teapot);context->setUniformMatrix("WORLD", world_teapot.toMat3());...teapot->draw();wvpMatrix_cube = proj * view * world_cube* mat4::translation(0.0, -0.0, -20.0);context->setUniformMatrix("WORLD_VIEW_PROJECTION", wvpMatrix_cube);context->setUniformMatrix("WORLD", world_cube.toMat3());cube->draw();}while ( context->update() );10. Rebuild the project and run it. Figure 4-8 now shows a shapes at different location on thez axis:Figure 4-8 The lighting example with a cube and teapot vertically offsetARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 4-24ID070710Non-Confidential - Draft - Beta

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

Saved successfully!

Ooh no, something went wrong!