void ChangeSize(int w, int h) { GLfloat nRange = 500.0f; windowWidth = w; windowHeight = h; // Verhindere eine Division durch Null if (h == 0) { h = 1; } // Setze den Viewport gemaess der Window-Groesse glViewport(0, 0, w, h); // Ruecksetzung des Projection matrix stack projectionMatrix.LoadIdentity(); if (bPerspectiveProj) { // Definiere das viewing volume (left, right, bottom, top, near, far) if (w <= h) { viewFrustum.SetPerspective(30.0f, h/w, 1, 3000); } else { viewFrustum.SetPerspective(30.0f, w / h, 1, 3000); } } else { // Definiere das viewing volume (left, right, bottom, top, near, far) if (w <= h) { viewFrustum.SetOrthographic(-nRange, nRange, -nRange*h / w, nRange*h / w, -nRange, nRange); } else { viewFrustum.SetOrthographic(-nRange*w / h, nRange*w / h, -nRange, nRange, -nRange, nRange); } } projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix()); // Ruecksetzung des Model view matrix stack modelViewMatrix.LoadIdentity(); TwWindowSize(w, h); }
void ChangeSize(int w, int h) { // Prevent a divide by zero if(h == 0) h = 1; // Set Viewport to window dimensions glViewport(0, 0, w, h); // Establish clipping volume (left, right, bottom, top, near, far) viewFrustum.SetOrthographic(0.0f, SCREEN_X, 0.0f, SCREEN_Y, -1.0f, 1.0f); }
void ChangeSize(int w, int h) { // Prevent a divide by zero if(h == 0) h = 1; // Set Viewport to window dimensions glViewport(0, 0, w, h); viewFrustum.SetOrthographic(-130.0f, 130.0f, -130.0f, 130.0f, -130.0f, 130.0f); projectionMatrix.LoadMatrix(viewFrustum.GetProjectionMatrix()); transformPipeline.SetMatrixStacks(modelViewMatix, projectionMatrix); }