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...SceneAsset* scene = proxy.getSceneAsset("lightshow2_eksempelscene.MBA");Program* program = proxy.getProgramAsset("default.vert;default.frag")->getProgram();context->setProgram(program);3. Example 4-54 shows the camera and lighting setup:Example 4-54 Set the camera and light values...//int numCams = scene->getAssetCount(Asset::TYPE_CAMERA);int currentCam = 0;float camFov = 270.0f;float camAspect = 4.0f/3.0f;float time = timer->getTime();vec3 lightPos(0.0f, 0.0f, 0.0f);vec3 camTarget(0.0f, 0.0f, 0.0f);vec3 camPos(0.0f, 0.0f, 0.0f);...glEnable(GL_CULL_FACE);glCullFace(GL_BACK);glEnable(GL_DEPTH_TEST);4. Example 4-55 shows the part of the draw loop that manages the camera:Example 4-55 Getting the camera asset...do{#if FIXED_FRAMERATE == 1time += TIME_INCREMENT;#elsetime = timer->getTime();#endif::printf("%f\n", time);glClearColor(0.0f, 0.0f, 0.0f, 1.0f);glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);// Get camera assetCameraAsset* cam = (CameraAsset*)scene->getAsset(Asset::TYPE_CAMERA, currentCam);if (cam){// Find nodes in camera:Array nodes;scene->findAssetNodes(cam, scene->getTree(0), nodes);// Set camera and target node:NodeAsset* camNode = nodes[0]->data;NodeAsset* targetNode = cam->getTargetNode();// Set camera positionif(camNode)camPos = camNode->getAbsolutePosition();// Set target node positionARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 4-43ID070710Non-Confidential - Draft - Beta

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

Saved successfully!

Ooh no, something went wrong!