Created
May 28, 2018 07:58
-
-
Save blkrt/ee13bb07b946bc8050fd08bf96ccafde to your computer and use it in GitHub Desktop.
Cube 2D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Gl/glut.h> | |
void display(void) | |
{ | |
glClear(GL_COLOR_BUFFER_BIT); | |
glRotatef(50,1,0,1); | |
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); | |
glBegin(GL_QUADS); | |
glVertex3f(0.0, 0.0, 0.0); | |
glVertex3f(0.5, 0.0, 0.0); | |
glVertex3f(0.5, 0.5, 0.0); | |
glVertex3f(0.0,0.5, 0.0); | |
glVertex3f(0.0, 0.0, -0.5); | |
glVertex3f(0.5, 0.0, -0.5); | |
glVertex3f(0.5, 0.5, -0.5); | |
glVertex3f(0.0, 0.5, -0.5); | |
glEnd(); | |
glBegin(GL_LINES); | |
glVertex3f(0.0, 0.5, 0.0); | |
glVertex3f(0.0, 0.5, -0.5); | |
glVertex3f(0.0, 0.0, 0.0); | |
glVertex3f(0.0, 0.0, -0.5); | |
glVertex3f(0.5, 0.0, 0.0); | |
glVertex3f(0.5, 0.0, -0.5); | |
glVertex3f(0.5,0.5, 0.0); | |
glVertex3f(0.5, 0.5, -0.5); | |
glEnd(); | |
glutSwapBuffers(); | |
} | |
int main(int argc,char ** argv) | |
{ | |
glutInit(&argc,argv); | |
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPTH); | |
glutInitWindowSize(500,500); | |
glutInitWindowPosition(0,0); | |
glutCreateWindow("Rotating Cube"); | |
glutDisplayFunc(display); | |
glutMainLoop(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment