6.5.1. In-line source code

Example 6.16 shows:

Example 6.16. Specifying the attributes for the vertex source elements

...
    const char* vertexsource =
        "attribute vec4 POSITION; \
        attribute vec4 COLOR;\
        varying vec4 col;\
        void main(void)\
        {\
        col = COLOR;\
        gl_Position = POSITION;\
        }";

    const char* fragmentsource =
        "precision mediump float; \
        varying vec4 col;\
        void main(void)\
        {\
        gl_FragColor = col;\
        }";
    Managed<Shader> vertexshader = 
            context->createShader(GL_VERTEX_SHADER, vertexsource);
    Managed<Shader> fragmentshader =
            context->createShader(GL_FRAGMENT_SHADER, fragmentsource);
    Managed<Program> program = context->createProgram(vertexshader, fragmentshader);
    context->setProgram(program);
...

Copyright © 2010 ARM. All rights reserved.ARM DUI 0527A‑02a
Non-Confidential - Draft - BetaID070710