Skip to content

Instantly share code, notes, and snippets.

@jsheedy

jsheedy/Makefile

Created Mar 28, 2017
Embed
What would you like to do?
boring old cube GL
#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;
}
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
You can’t perform that action at this time.