togl: gluPerspective moved to draw function

This commit is contained in:
Joachim Schoeberl 2012-09-20 08:52:42 +00:00
parent 047107e0c9
commit 113771b7fa

View File

@ -1876,6 +1876,24 @@ namespace netgen
{ {
if (nodisplay) if (nodisplay)
return; 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); Tcl_Interp * interp = Togl_Interp(togl);
@ -1910,17 +1928,17 @@ namespace netgen
glLoadIdentity(); glLoadIdentity();
// gluLookAt (0, 0, 6, 0, 0, 0, 0, 1, 0); // gluLookAt (0, 0, 6, 0, 0, 0, 0, 1, 0);
vs->DrawScene(); vs->DrawScene();
Togl_SwapBuffers(togl);
glPopMatrix(); glPopMatrix();
Togl_SwapBuffers(togl);
} }
} }
static void reshape( struct Togl *togl) static void reshape( struct Togl *togl)
{ {
/*
if (nodisplay) if (nodisplay)
return; return;
int w = Togl_Width (togl); int w = Togl_Width (togl);
int h = Togl_Height (togl); int h = Togl_Height (togl);
@ -1937,6 +1955,7 @@ namespace netgen
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
draw (togl); draw (togl);
*/
} }