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 Shapes/* Note that the following are already swapped in case of user input = -rotated */if ( args.height != 0 ) height = args.height;if ( args.width != 0 ) width = args.width;try{// Run from the directory containing the executable, so that we can find the data wherever it is run fromcdToExecutable();Managed system = create_system_backend();Managed context = system->createContext(width, height);Managed fs = system->createFileSystem("data");Managed timer = system->createTimer();Managed fps_timer = system->createTimer();Proxy proxy(fs, context);SceneAsset* scene = proxy.getSceneAsset("lightshow.MBA");Program* flarePrg = proxy.getProgram("flare.vert;flare.frag");Program* prg = proxy.getProgram("lightshow.vert;lightshow.frag");NodeAsset* camNode = (NodeAsset*)scene->getAsset(Asset::TYPE_NODE, "Camera01-node");NodeAsset* targetNode = (NodeAsset*)scene->getAsset(Asset::TYPE_NODE, "Camera01.Target-node");NodeAsset* light0Node = (NodeAsset*)scene->getAsset(Asset::TYPE_NODE, "Omni01-node");NodeAsset* light1Node = (NodeAsset*)scene->getAsset(Asset::TYPE_NODE, "Omni02-node");Texture* flareTex = proxy.getTexture2D("flare.png");glEnable(GL_DEPTH_TEST);...4. Example 4-61 shows start of the draw loop and the code that calculates and displays thecurrent frame rate:Example 4-61 Draw loop with frame rate calculation...float time = 0.0;do{/*If FPS measurement is required and start_frame has been entered and current frame is thestart_frame then store current time only onceORif FPS measurement is required and start_frame has not been entered then store currenttime every frame*/if ( args.print_fps && ( args.start_frame == 0)){current_time = fps_timer->getTime();}if ( args.print_fps && ( args.start_frame != 0) && ( frameCount == args.start_frame )){old_time = fps_timer->getTime();}if( first_time ){ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 4-49ID070710Non-Confidential - Draft - Beta

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

Saved successfully!

Ooh no, something went wrong!