Hello Square: Colors
This example shows how to use parameters to the color output of a shader.
Change color:
// World View Projection matrix that will transform the input vertices // to screen space. uniform mat4 worldViewProjection; // input parameters for our vertex shader attribute vec4 position; /** * The vertex shader simply transforms the input vertices to screen space. */ void main() { // Multiply the vertex positions by the worldViewProjection matrix to // transform them to screen space. gl_Position = worldViewProjection * position; } // This hack his here for now since O3D only allows one string // to be passed to Effect::loadFromFXString // #o3d SplitMarker // #o3d MatrixLoadOrder RowMajor // Color to draw with. uniform vec4 color; /** * This pixel shader just returns the color red. */ void main() { gl_FragColor = color; } // Here we tell our effect file *which* functions are // our vertex and pixel shaders.