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 the Lotion <strong>User</strong> <strong>Interface</strong> Classesmat4 rootTransform = mat4::identity();traverseTransform(scene->getTree(0), rootTransform, scenetime);vec3 camPos = camNode->getAbsolutePosition();vec3 targetPos = targetNode->getAbsolutePosition();mat4 view = mat4::lookAt(camPos, targetPos, vec3(0, 0, 1));mat4 proj = mat4::perspective(80, 1.33333f, 1, 500);context->setProgram(prg);context->setUniformMatrix("VIEW_PROJECTION", proj * view);vec3 light0position = light0Node->getAbsolutePosition();vec3 light0color(0.66f + fabs(sinf(time * 0.1f)) * 0.4f,0.66f + fabs(sinf(time * 0.12f + 0.4f)) * 0.4f,0.66f + fabs(sinf(time * 0.18f + 0.989f)) * 0.4f);context->setUniform("light0position", light0position);context->setUniform("light0color", light0color);vec3 light1position = light1Node->getAbsolutePosition();vec3 light1color(0.66f + fabs(sinf(time * 0.1f)) * 0.4f,0.66f + fabs(sinf(time * 0.12f + 0.14f)) * 0.4f,0.66f + fabs(sinf(time * 0.18f + 0.389f)) * 0.4f);context->setUniform("light1position", light1position);context->setUniform("light1color", light1color);context->setUniform("cameraPosition", camPos);float cyl_radius = sqrt(30.0f);vec3 shadow_info[2] ={ calculate_cyl_info(vec2(-30.0, -30.0), cyl_radius,vec2(light0position.x,light0position.y), 0.0),calculate_cyl_info(vec2(30.0, 30.0), cyl_radius,vec2(light0position.x, light0position.y), 0.0) };context->setUniform("shadow_info[0]", shadow_info[0]);context->setUniform("shadow_info[1]", shadow_info[1]);glEnable(GL_DEPTH_TEST);traverseDraw(scene->getTree(0), context);glDepthMask(GL_FALSE);glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA, GL_ONE);context->setProgram(flarePrg);context->setUniformMatrix("VIEW", view);context->setUniformMatrix("PROJECTION", proj);context->setUniformSampler("colorTex", flareTex);drawFlare(context, light0position, light0color, 10);glDepthMask(GL_TRUE);glDisable(GL_BLEND);}// new code to make the widget visible and draw the imagewg->setVisible(true);Applet::draw();ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 5-31ID070710Non-Confidential - Draft - Beta

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

Saved successfully!

Ooh no, something went wrong!