From: Alexander Schmidt Date: Fri, 15 Jul 2016 11:22:10 +0000 (+0200) Subject: Use double buffering X-Git-Url: http://git.treefish.org/~alex/seamulator.git/commitdiff_plain/986ab15c99a77bf9d2f827c2bad9c00dea9665d5?ds=sidebyside Use double buffering --- diff --git a/seamulator.cpp b/seamulator.cpp index 8f6b5d8..572c154 100644 --- a/seamulator.cpp +++ b/seamulator.cpp @@ -13,9 +13,9 @@ WaterSurfacePtr surface; void setupView() { - glMatrixMode(GL_PROJECTION); // Switch to the projection matrix so that we can manipulate how our scene is viewed - glLoadIdentity(); // Reset the projection matrix to the identity matrix so that we don't get any artifacts (cleaning up) - gluPerspective(50, (GLfloat)300 / (GLfloat)300, 0, 1000); // Set the Field of view angle (in degrees), the aspect ratio of our window, and the new and far planes + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(50, (GLfloat)300 / (GLfloat)300, 0, 1000); gluLookAt(0,-10,10, 0,0,0, 0,1,0); } @@ -31,7 +31,7 @@ void displayMe(void) sea->update(); surface->draw(); - glFlush(); + glutSwapBuffers(); glutPostRedisplay(); } @@ -44,8 +44,7 @@ int main(int argc, char** argv) sea = std::make_shared(surface); glutInit(&argc, argv); - glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH); - glEnable(GL_DEPTH_TEST); + glutInitDisplayMode(GLUT_DOUBLE); glutInitWindowSize(300, 300); glutInitWindowPosition(100, 100); glutCreateWindow("seamulator");