From 113771b7fa4815f1619b589d1ee29c43d24e9348 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Thu, 20 Sep 2012 08:52:42 +0000 Subject: [PATCH] togl: gluPerspective moved to draw function --- ng/ngpkg.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/ng/ngpkg.cpp b/ng/ngpkg.cpp index 858b9d50..608ce829 100644 --- a/ng/ngpkg.cpp +++ b/ng/ngpkg.cpp @@ -1876,6 +1876,24 @@ namespace netgen { if (nodisplay) return; + + + int w = Togl_Width (togl); + int h = Togl_Height (togl); + + glViewport(0, 0, w, h); + + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + + // OpenGL near and far clipping planes + double pnear = 0.1; + double pfar = 10; + + gluPerspective(20.0f, double(w) / h, pnear, pfar); + glMatrixMode(GL_MODELVIEW); + + Tcl_Interp * interp = Togl_Interp(togl); @@ -1910,17 +1928,17 @@ namespace netgen glLoadIdentity(); // gluLookAt (0, 0, 6, 0, 0, 0, 0, 1, 0); vs->DrawScene(); - - Togl_SwapBuffers(togl); glPopMatrix(); + Togl_SwapBuffers(togl); } } static void reshape( struct Togl *togl) { + /* if (nodisplay) return; - + int w = Togl_Width (togl); int h = Togl_Height (togl); @@ -1937,6 +1955,7 @@ namespace netgen glMatrixMode(GL_MODELVIEW); draw (togl); + */ }