Skip to content

Instantly share code, notes, and snippets.

@R2ZER0
Created January 14, 2015 18:41
Show Gist options
  • Save R2ZER0/c80ca7586aaf5e535142 to your computer and use it in GitHub Desktop.
Save R2ZER0/c80ca7586aaf5e535142 to your computer and use it in GitHub Desktop.
#include <stdlib.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
// See: http://nehe.gamedev.net/tutorial/lessons_01__05/22004/
/* Render a frame */
void DrawGLScene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_TRIANGLES);
glVertex3f(-0.5,-0.5,0.0);
glVertex3f(0.5,0.0,0.0);
glVertex3f(0.0,0.5,0.0);
glEnd();
glutSwapBuffers();
}
/* Initialisation */
int main(int argc, char** argv)
{
/* Initialise glut */
glutInit(&argc, argv);
glutInitWindowSize(600, 400);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutCreateWindow("Test Window");
/* Setup callbacks */
glutDisplayFunc(&DrawGLScene);
/* Initialise OpenGL */
// glEnable(GL_DEPTH_TEST);
// glDepthFunc(GL_LESS);
// glShadeModel(GL_SMOOTH);
/* Run the main loop */
glutMainLoop();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment