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 ShapesExample 3-9 Vertex shading of simple triangle with floating-point color values......GLfloat vertexData[] ={-1.0, -1.0,1.0, -1.0,0.0, 1.0};GLfloat colorData[] ={1.0, 0, 0, 1.0,0, 1.0, 0, 1.0,0, 0, 1.0 1.0};3. Change the vertex definition code to use floating-point for color values as shown inExample 3-10:Example 3-10 Using floating-point values for the color buffers...Managed vertexBuffer = context->createBuffer(GL_ARRAY_BUFFER, sizeof(vertexData),sizeof(GLfloat)*2);vertexBuffer->setData(0, sizeof(vertexData), vertexData);Managed colorBuffer = context->createBuffer(GL_ARRAY_BUFFER, sizeof(colorData),sizeof(GLfloat)*4);colorBuffer->setData(0, sizeof(colorData), colorData);VertexElement elements[2];elements[0].components = 2;elements[0].offset = 0;elements[0].semantic = POSITION;elements[0].stream = 0;elements[0].type = GL_FLOAT;elements[0].normalize = false;...elements[1].components = 4;elements[1].offset = 0;elements[1].semantic = COLOR;elements[1].stream = 1;elements[1].type = GL_FLOAT;elements[1].normalize = true;4. Rebuild the project and run it. Figure 3-3 on page 3-9 shows the triangle appearance hasnot changed:ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 3-8ID070710Non-Confidential - Draft - Beta

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

Saved successfully!

Ooh no, something went wrong!