Skip to content

Instantly share code, notes, and snippets.

@mikedouglas
Created January 31, 2011 05:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikedouglas/803667 to your computer and use it in GitHub Desktop.
Save mikedouglas/803667 to your computer and use it in GitHub Desktop.
#ifdef __APPLE__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#else
#ifdef _WIN32
#include <windows.h>
#endif
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
#endif
void Init() {
glClearColor(1, 1, 1, 0);
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0, 0, 0);
glLoadIdentity();
}
void RenderScene() {
glRectf(-0.5, -0.5, 0.5, 0.5);
glutSwapBuffers();
}
int main(int argc, char** argv) {
glutInit(&argc, argv);
glutInitWindowSize(500, 500);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA);
glutCreateWindow("My second OpenGL Program");
glutDisplayFunc(RenderScene);
Init();
glutMainLoop();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment