void ofMatrixStack::viewport(float x, float y, float width, float height, bool vflip){ if(!doesHWOrientation() && (orientation==OF_ORIENTATION_90_LEFT || orientation==OF_ORIENTATION_90_RIGHT)){ swap(width,height); swap(x,y); } if(width == 0 || height == 0){ width = getRenderSurfaceWidth(); height = getRenderSurfaceHeight(); } if (vflip){ y = getRenderSurfaceHeight() - (y + height); } currentViewport.set(x,y,width,height); }
ofRectangle ofMatrixStack::getCurrentViewport() const{ ofRectangle tmpCurrentViewport = currentViewport; if (isVFlipped()){ tmpCurrentViewport.y = getRenderSurfaceHeight() - (tmpCurrentViewport.y + tmpCurrentViewport.height); } if(!doesHWOrientation() && (orientation==OF_ORIENTATION_90_LEFT || orientation==OF_ORIENTATION_90_RIGHT)){ swap(tmpCurrentViewport.width,tmpCurrentViewport.height); swap(tmpCurrentViewport.x,tmpCurrentViewport.y); } return tmpCurrentViewport; }
ofRectangle ofMatrixStack::getCurrentViewport(){ ofRectangle currentViewport = this->currentViewport; if (isVFlipped()){ currentViewport.y = getRenderSurfaceHeight() - (currentViewport.y + currentViewport.height); } if(!doesHWOrientation() && (orientation==OF_ORIENTATION_90_LEFT || orientation==OF_ORIENTATION_90_RIGHT)){ swap(currentViewport.width,currentViewport.height); swap(currentViewport.x,currentViewport.y); } return currentViewport; }