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}}printf(e.getMessage().getCharString());10. Rebuild the project and run it. Figure 4-10 shows the shape:Figure 4-10 The cube shape with bump-mapped shading11. Use the keyboard to change the view:• press the left or right arrows to rotate the cube• depress the spacebar and then press the left or right arrows to move the camera.12. The initialization code sets both the contribution from each light source and its color:const float AMBIENT = 0.2;const float DIFFUSE_CONTRIBUTION = 0.7;const float SPECULAR_CONTRIBUTION = 0.4;static const vec3 AMBIENT_LIGHT = vec3 (0.2f, 0.2f, 0.2f);static const vec3 DIFFUSE_LIGHT = vec3(0.7f, 0.7f, 0.7f);static const vec3 SPECULAR_LIGHT = vec3(0.4f, 0.4f, 0.4f);Change the intensity of the different light sources and observe how the image changes:• ambient light comes from all directions and provides uniform base lighting asshown in Figure 4-11• diffuse light comes from a single direction and is a flat even light as shown inFigure 4-12 on page 4-31• specular light comes from a single direction, and reflects off the image at a specificangle between the viewer and the light source as shown in Figure 4-13 onpage 4-31. Specular light reflections are typically just the color of the specular lightsource and not the object color. Change the color of the specular light and notice thecolored reflections shown in Figure 4-14 on page 4-31.Figure 4-11 Ambient light onlyARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 4-30ID070710Non-Confidential - Draft - Beta

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

Saved successfully!

Ooh no, something went wrong!