Created
March 28, 2017 00:43
-
-
Save jsheedy/7becd9180b851b0db67d76f236653eea to your computer and use it in GitHub Desktop.
boring old cube GL
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 <stdlib.h> | |
#include <stdio.h> | |
#include <math.h> | |
#include <OpenGL/gl.h> | |
#include <GLUT/glut.h> | |
int windowWidth; | |
float rot = 0.0f; | |
static void display( void ) | |
{ | |
glClear(GL_COLOR_BUFFER_BIT); | |
glPushMatrix(); | |
glRotatef(rot, 1, 1, 1); | |
glBegin(GL_POLYGON); | |
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); | |
glEnd(); | |
glPopMatrix(); | |
glutSwapBuffers(); | |
printf("WAT %1.1f\n", rot); | |
} | |
static void idle(void) { | |
rot += 0.1; | |
display(); | |
} | |
int main(int argc, char** argv) | |
{ | |
glutInit (&argc,argv); | |
// glutInitDisplayMode (GLUT_SINGLE); | |
glutInitDisplayMode (GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); | |
glutInitWindowSize (300,300); | |
glutInitWindowPosition (0,0); | |
glutCreateWindow ("BORING OLD CUBE"); | |
glutDisplayFunc (display); | |
glutIdleFunc(idle); | |
glutMainLoop(); | |
return 0; | |
} |
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
cube: | |
gcc boring_old_cube.cpp -framework OpenGL -framework GLUT -o boring_old_cube -w |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment