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 2D Shapes...elements[1].type = GL_FLOAT;elements[1].normalize = true;The colorBuffer array is not required because the color information is now part of thevertexData array.The offset for elements[1] must be specified as 2*sizeof(GLfloat) to jump over theposition values.4. The triangle has been specified, so it can be drawn as shown in Example 3-6 on page 3-5.Example 3-13 Using the vertex information to draw the triangle...do{context->setVertexBuffer(0, vertexBuffer);context->setVertexBuffer(1, vertexBuffer);/* Draw indexed triangles using the first 3 vertices of the buffers */context->drawArrays(GL_TRIANGLES, 0, 1);if(keyboard->getSpecialKeyState(Keyboard::KEY_ESCAPE)) break;} while( context->update() );}}catch(Exception& e){printf("MDE \n%s\n\n", e.getMessage().getCharString());}Unlike in Example 3-6 on page 3-5, the context uses vertexBuffer for both stream 0 andstream 1 because both stream values are contained in one array.5. Rebuild the project and run it. Figure 3-3 on page 3-9 shows the triangle appearance hasnot changed:Figure 3-4 The 2D triangle with combined position and color values in one vertexBuffer arrayARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 3-10ID070710Non-Confidential - Draft - Beta

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

Saved successfully!

Ooh no, something went wrong!