//----------------------------------------------------------------------------- // preRender() //----------------------------------------------------------------------------- void LLViewerDynamicTexture::preRender(BOOL clear_depth) { { // force rendering to on-screen portion of frame buffer LLCoordScreen window_pos; gViewerWindow->getWindow()->getPosition( &window_pos ); mOrigin.set(0, gViewerWindow->getWindowHeightRaw() - mFullHeight); // top left corner if (window_pos.mX < 0) { mOrigin.mX = -window_pos.mX; } if (window_pos.mY < 0) { mOrigin.mY += window_pos.mY; mOrigin.mY = llmax(mOrigin.mY, 0) ; } gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } // Set up camera LLViewerCamera* camera = LLViewerCamera::getInstance(); mCamera.setOrigin(*camera); mCamera.setAxes(*camera); mCamera.setAspect(camera->getAspect()); mCamera.setView(camera->getView()); mCamera.setNear(camera->getNear()); glViewport(mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight); if (clear_depth) { glClear(GL_DEPTH_BUFFER_BIT); } }
//----------------------------------------------------------------------------- // preRender() //----------------------------------------------------------------------------- void LLViewerDynamicTexture::preRender(BOOL clear_depth) { //only images up to 512x512 are supported llassert(mFullHeight <= 512); llassert(mFullWidth <= 512); if (gGLManager.mHasFramebufferObject && gPipeline.mWaterDis.isComplete()) { //using offscreen render target, just use the bottom left corner mOrigin.set(0, 0); } else { // force rendering to on-screen portion of frame buffer LLCoordScreen window_pos; gViewerWindow->getWindow()->getPosition( &window_pos ); mOrigin.set(0, gViewerWindow->getWindowHeightRaw() - mFullHeight); // top left corner if (window_pos.mX < 0) { mOrigin.mX = -window_pos.mX; } if (window_pos.mY < 0) { mOrigin.mY += window_pos.mY; mOrigin.mY = llmax(mOrigin.mY, 0) ; } } gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Set up camera LLViewerCamera* camera = LLViewerCamera::getInstance(); mCamera.setOrigin(*camera); mCamera.setAxes(*camera); mCamera.setAspect(camera->getAspect()); mCamera.setView(camera->getView()); mCamera.setNear(camera->getNear()); glViewport(mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight); if (clear_depth) { glClear(GL_DEPTH_BUFFER_BIT); } }