void Application::setOrthoView(int x, int y, int viewWidth, int viewHeight, scalar orthoWidth, scalar orthoHeight) { // set viewport & ortho projection setViewport(x,y,viewWidth,viewHeight); setOrthoProjection(orthoWidth,orthoHeight); }
void AnaglyphRenderer::draw() { CHECK_GL_ERROR GLFrame *glFrame = renderer->getGLFrame(); float eyesShift = 5.0 * settings.eyesShift * glFrame->getCameraPosition().z / 200.0; glMatrixMode(GL_MODELVIEW); // Prepare anaglyph textures glPushMatrix(); //glTranslatef(eyesShift, 0, 0); glLoadIdentity(); gluLookAt(eyesShift, 0.0, glFrame->getCameraPosition().z, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); // at this moment buffer must be clean glClear omitted as a slow operation //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // isolate errors from main scene renderer CHECK_GL_ERROR renderer->draw(); glGetError(); glBindTexture(GL_TEXTURE_2D, anaglyphRenderTextureRight); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, width, height, 0); glPopMatrix(); glPushMatrix(); //glTranslatef(-eyesShift, 0, 0); glLoadIdentity(); gluLookAt(-eyesShift, 0.0, glFrame->getCameraPosition().z, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // isolate errors from main scene renderer CHECK_GL_ERROR renderer->draw(); glGetError(); glBindTexture(GL_TEXTURE_2D, anaglyphRenderTextureLeft); glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, width, height, 0); glPopMatrix(); // Draw anaglyph textures in ortho projection glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glPushMatrix(); setOrthoProjection(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); drawTexturesAnaglyph(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); CHECK_GL_ERROR }
void Application::setOrthoView() { // set viewport to fullscreen, then set ortho (1:1 ratio) setViewport(0, 0, displayWidth_, displayHeight_); setOrthoProjection(displayWidth_, displayHeight_); }
void Application::setOrthoView(scalar width, scalar height) { // set viewport to fullscreen, then set ortho (alternative ratio) setViewport(0, 0, displayWidth_, displayHeight_); setOrthoProjection(width,height); }