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}// look up color in texture map and multiply by the color uniformgl_FragColor = vec4(texture2D(colorTex, outTexcoord).xyz * 2.0 * color,1);11. Rebuild the project and run it. See Figure 4-23:Figure 4-23 The Lighting image with moving camera and objectThe asset contains:• all of the shaders• the environment bitmaps• the path for the moving flare• the camera path• the lighting sources.The asset file is organized in nodes. The application calls the traverseDraw() anddrawFlare() functions to calculate the current positions and draw the environment andflare.12. Modify the flare code in main.cpp as shown in Example 4-68 to make the flare oscillate insize:Example 4-68 Modifying the flare...glDepthMask(GL_FALSE);glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA, GL_ONE);// specify flare.vert and flare.frag as the active shaderscontext->setProgram(flarePrg);context->setUniformMatrix("VIEW", view);context->setUniformMatrix("PROJECTION", proj);context->setUniformSampler("colorTex", flareTex);// call drawFlare with the light position, color, and flare size// drawFlare(context, light0position, light0color, 10);// vary the size of the flare based on the frame numberdrawFlare(context, light0position, light0color, (5+3*sin(frameCount*.020)));glDepthMask(GL_TRUE);glDisable(GL_BLEND);frameCount++;}while (context->update());catch(Exception& e){ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 4-55ID070710Non-Confidential - Draft - Beta

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

Saved successfully!

Ooh no, something went wrong!