Hello Cube
This example shows how to display a spinning red cube in O3D.
// World View Projection matrix that will transform the input vertices // to screen space. attribute vec4 position; uniform mat4 world; uniform mat4 view; uniform mat4 projection; /** * 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 = projection * view * world * position; }
/** * This pixel shader just returns the color red. */ void main() { gl_FragColor = vec4(1, 0, 0, 1); // Red. }