A SERVICE OF

logo

Cube.cxx Explained
199
// swap buffers
csWindow::swapBuffers();
frame++;
return csWindow::CONTINUE;
}
//Create a cube; the cube will be rendered twice.
static csGroup*
makeCube()
{
// int i;
static float cubeCoords[24][3] =
{
{-1.0f, -1.0f, 1.0f}, { 1.0f, -1.0f, 1.0f}, // +Z
{ 1.0f, 1.0f, 1.0f}, {-1.0f, 1.0f, 1.0f}, // +Z
{-1.0f, -1.0f, -1.0f}, {-1.0f, 1.0f, -1.0f}, // -Z
{ 1.0f, 1.0f, -1.0f}, { 1.0f, -1.0f, -1.0f}, // -Z
{ 1.0f, -1.0f, 1.0f}, { 1.0f, -1.0f, -1.0f}, // +X
{ 1.0f, 1.0f, -1.0f}, { 1.0f, 1.0f, 1.0f}, // +X
{-1.0f, -1.0f, 1.0f}, {-1.0f, 1.0f, 1.0f}, // -X
{-1.0f, 1.0f, -1.0f}, {-1.0f, -1.0f, -1.0f}, // -X
{-1.0f, 1.0f, 1.0f}, { 1.0f, 1.0f, 1.0f}, // +Y
{ 1.0f, 1.0f, -1.0f}, {-1.0f, 1.0f, -1.0f}, // +Y
{-1.0f, -1.0f, 1.0f}, {-1.0f, -1.0f, -1.0f}, // -Y
{ 1.0f, -1.0f, -1.0f}, { 1.0f, -1.0f, 1.0f} // -Y
};
static int numCubeCoords =
sizeof(cubeCoords)/sizeof(cubeCoords[0]);
static float cubeNorms[6][3] =
{
{ 0.0f, 0.0f, 1.0f}, // +Z
{ 0.0f, 0.0f, -1.0f}, // -Z
{ 1.0f, 0.0f, 0.0f}, // +X
{-1.0f, 0.0f, 0.0f}, // -X
{ 0.0f, 1.0f, 0.0f}, // +Y
{ 0.0f, -1.0f, 0.0f} // -Y
};
static int numCubeNorms = sizeof(cubeNorms)/sizeof(cubeNorms[0]);
// Specify the data attributes
// specify cube as 6 quads