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...0.5f, -0.5f, -0.5f, 0.0f, 1.0f,0.5f, 0.5f, -0.5f, 1.0f, 1.0f,-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, //LEFT xyz for vertices, uv for texture-0.5f, 0.5f, 0.5f, 1.0f, 0.0f,-0.5f, -0.5f, -0.5f, 0.0f, 1.0f,-0.5f, 0.5f, 0.5f, 1.0f, 0.0f,-0.5f, -0.5f, -0.5f, 0.0f, 1.0f,-0.5f, 0.5f, -0.5f, 1.0f, 1.0f,0.5f, -0.5f, -0.5f, 0.0f, 0.0f, //RIGHT xyz for vertices, uv for texture0.5f, 0.5f, -0.5f, 1.0f, 0.0f,0.5f, -0.5f, 0.5f, 0.0f, 1.0f,0.5f, 0.5f, -0.5f, 1.0f, 0.0f,0.5f, -0.5f, 0.5f, 0.0f, 1.0f,0.5f, 0.5f, 0.5f, 1.0f, 1.0f,-0.5f, 0.5f, 0.5f, 0.0f, 0.0f, //TOP xyz for vertices, uv for texture0.5f, 0.5f, 0.5f, 1.0f, 0.0f,-0.5f, 0.5f, -0.5f, 0.0f, 1.0f,0.5f, 0.5f, 0.5f, 1.0f, 0.0f,-0.5f, 0.5f, -0.5f, 0.0f, 1.0f,0.5f, 0.5f, -0.5f, 1.0f, 1.0f,-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, //BOTTOM xyz for vertices, uv for texture-0.5f, -0.5f, -0.5f, 1.0f, 0.0f,0.5f, -0.5f, 0.5f, 0.0f, 1.0f,-0.5f, -0.5f, 0.5f, 0.0f, 0.0f,-0.5f, -0.5f, -0.5f, 1.0f, 0.0f,0.5f, -0.5f, -0.5f, 1.0f, 1.0f,}2. Example 4-14 shows how to change the draw loop use GL_TRIANGLES instead ofGL_TRIANGLE_STRIPS:Example 4-14 Drawing GL_TRIANGLES......glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);context->drawArrays(GL_TRIANGLES, 0, 12); // draw each triangle}while ( context->update() );3. Rebuild the project and run it.4.3.2 Drawing individual triangles from the cube shapeTo emphasize that the graphic consists of many separate 2D surfaces, remove some of the faces:1. Delete every other triangle as shown in Example 4-15:Example 4-15 Deleting triangles from the vertexData array...GLfloat vertexData[] = {-0.5f, -0.5f, 0.5f, 0.0f, 0.0f, //FRONT xyz for vertices, uv for texture0.5f, -0.5f, 0.5f, 1.0f, 0.0f,-0.5f, 0.5f, 0.5f, 0.0f, 1.0f,// 0.5f, -0.5f, 0.5f, 1.0f, 0.0f, // second triangle for front face// -0.5f, 0.5f, 0.5f, 0.0f, 1.0f,// 0.5f, 0.5f, 0.5f, 1.0f, 1.0f,ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 4-12ID070710Non-Confidential - Draft - Beta

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

Saved successfully!

Ooh no, something went wrong!