Last active
August 29, 2015 14:18
Revisions
-
agjaeger revised this gist
Apr 9, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -36,10 +36,10 @@ void reshape(GLsizei width, GLsizei height) { height = 1; // Avoids divide by zero error } GLFloat aspect = (GLfloat) width / (Glfloat) height; glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0f, aspect, 0.1f, 100.0f); -
agjaeger revised this gist
Apr 9, 2015 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ /* g++ main.cpp -lglut -lGL -lGLU */ -
agjaeger created this gist
Apr 9, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,64 @@ /* g++ main.cpp -lglut -lGL -lGLU */ #include "GL/freeglut.h" #include "GL/gl.h" char title[] = "OpenGL Window"; void initGL() { glClearColor(0.93f, 0.93f, 0.93f, 1.0f); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); // Enable for z-culling glDepthFunc(GL_LEQUAL); glShadeModel(GL_SMOOTH); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); } void display() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); /* Insert Code Here */ glutSwapBuffers(); } void reshape(GLsizei width, GLsizei height) { if(height == 0) { height = 1; // Avoids divide by zero error } GLFloat aspect = (GLFloat) width / (GLFloat) height; glViewport(0, 0, width, height); glMatrixMode(PROJECTION); glLoadIdentity(); gluPerspective(45.0f, aspect, 0.1f, 100.0f); } int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE); glutInitWindowSize(640, 480); glutInitWindowPosition(50, 50); glutCreateWindow(title); glutDisplayFunc(display); glutReshapeFunc(reshape); initGL(); glutMainLoop(); return 0; }