Skip to content

Instantly share code, notes, and snippets.

@Vbitz
Created February 9, 2012 05:04
Show Gist options
  • Select an option

  • Save Vbitz/1777477 to your computer and use it in GitHub Desktop.

Select an option

Save Vbitz/1777477 to your computer and use it in GitHub Desktop.
void CubeSide::Draw()
{
if (!Enabled) return;
//openGL::glColor3i(125, 0, 0);
openGL::glColor4f(R, G, B, 255);
openGL::glVertex3f(Point1.X, Point1.Y, Point1.Z);
if (Point1.X == Point2.X)
{
openGL::glVertex3f(Point1.X, Point2.Y, Point1.Z);
openGL::glVertex3f(Point1.X, Point2.Y, Point2.Z);
openGL::glVertex3f(Point1.X, Point1.Y, Point1.Z);
openGL::glVertex3f(Point1.X, Point1.Y, Point2.Z);
openGL::glVertex3f(Point1.X, Point2.Y, Point2.Z);
}
else if (Point1.Y == Point2.Y)
{
openGL::glVertex3f(Point2.X, Point1.Y, Point1.Z);
openGL::glVertex3f(Point2.X, Point1.Y, Point2.Z);
openGL::glVertex3f(Point1.X, Point1.Y, Point1.Z);
openGL::glVertex3f(Point1.X, Point1.Y, Point2.Z);
openGL::glVertex3f(Point2.X, Point1.Y, Point2.Z);
}
else if (Point1.Z == Point2.Z)
{
openGL::glVertex3f(Point1.X, Point2.Y, Point1.Z);
openGL::glVertex3f(Point2.X, Point2.Y, Point1.Z);
openGL::glVertex3f(Point1.X, Point1.Y, Point1.Z);
openGL::glVertex3f(Point2.X, Point1.Y, Point1.Z);
openGL::glVertex3f(Point2.X, Point2.Y, Point1.Z);
}
}
Cube::Cube(int x, int y, int z)
{
topSide = CubeSide(x, y, z, x + 1, y + 1, z, 125, 0, 0);
bottomSide = CubeSide(x, y, z + 1, x + 1, y + 1, z + 1, 0, 125, 0);
frontSide = CubeSide(x, y, z, x, y + 1, z + 1, 0, 0, 125);
backSide = CubeSide(x + 1, y, z, x + 1, y + 1, z + 1 , 0, 0, 255);
leftSide = CubeSide(x, y, z, x + 1, y, z + 1, 0, 255, 0);
rightSide = CubeSide(x, y + 1, z, x + 1, y + 1, z + 1, 255, 0, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment