Int32 FBOViewport::getPixelBottom(void) const { if(getBottom() > 1) return Int32(getBottom()); if(getFrameBufferObject() == NULL) return Int32(getBottom()); return Int32(getFrameBufferObject()->getHeight() * getBottom()); }
bool FBOViewport::isFullWindow(void) const { if(getFrameBufferObject() == NULL) return true; return getPixelBottom() == 0 && getPixelLeft() == 0 && getPixelTop() == getFrameBufferObject()->getHeight() - 1 && getPixelRight() == getFrameBufferObject()->getWidth () - 1; }
bool StagedViewport::isFullWindow(void) const { if(getFrameBufferObject() == NULL) return Viewport::calcIsFullWindow(); else return getPixelBottom() == 0 && getPixelLeft() == 0 && getPixelTop() == getFrameBufferObject()->getHeight() - 1 && getPixelRight() == getFrameBufferObject()->getWidth () - 1; }
Int32 FBOViewport::getPixelTop(void) const { // >1: pixel if(getTop() > 1) return Int32(getTop()); if(getFrameBufferObject() == NULL) return Int32(getTop()); // <=1: partial screen, use 1 less to not overlap other windows return Int32(getFrameBufferObject()->getHeight() * getTop() - 1); }
Int32 StagedViewport::getPixelBottom(void) const { if(!getFrameBufferObject()) { // => behave like normal viewport return Viewport::calcPixelBottom(); } else { // => behave like FBOViewport if(getBottom() > 1) return Int32(getBottom()); return Int32(getFrameBufferObject()->getHeight() * getBottom()); } }
Int32 StagedViewport::getPixelTop(void) const { if(!getFrameBufferObject()) { // => behave like normal viewport return Viewport::calcPixelTop(); } else { // => behave like FBOViewport if(getTop() > 1) return Int32(getTop()); // <=1: partial screen, use 1 less to not overlap other windows return Int32(getFrameBufferObject()->getHeight() * getTop() - 1); } }
OSG_USING_NAMESPACE // Documentation for this class is emited in the // OSGFBOViewportBase.cpp file. // To modify it, please change the .fcd file (OSGFBOViewport.fcd) and // regenerate the base file. Int32 FBOViewport::getPixelLeft(void) const { if(getLeft() > 1) return Int32(getLeft()); if(getFrameBufferObject() == NULL) return Int32(getLeft()); return Int32(getFrameBufferObject()->getWidth() * getLeft()); }
void FBOViewport::render(DrawActionBase *action) { if(getFrameBufferObject() != NULL) { DrawEnv oEnv; oEnv.setWindow(action->getWindow()); getFrameBufferObject()->activate(&oEnv); Inherited::render(action); getFrameBufferObject()->deactivate(&oEnv); } else { Inherited::render(action); } }
void GLWindow::queryDrawableConfig( DrawableConfig& dc ) { dc = DrawableConfig(); // GL version const char* glVersion = (const char*)glGetString( GL_VERSION ); if( !glVersion ) // most likely no context { LBWARN << "glGetString(GL_VERSION) returned 0, assuming GL version 1.1" << std::endl; dc.glVersion = 1.1f; } else dc.glVersion = static_cast<float>( std::atof( glVersion )); if( dc.glVersion >= 3.2f ) { GLint mask; EQ_GL_CALL( glGetIntegerv( GL_CONTEXT_PROFILE_MASK, &mask )); dc.coreProfile = mask & GL_CONTEXT_CORE_PROFILE_BIT; } TEST_GLEW_VERSION( 1, 1 ); TEST_GLEW_VERSION( 1, 2 ); TEST_GLEW_VERSION( 1, 3 ); TEST_GLEW_VERSION( 1, 4 ); TEST_GLEW_VERSION( 1, 5 ); TEST_GLEW_VERSION( 2, 0 ); TEST_GLEW_VERSION( 2, 1 ); TEST_GLEW_VERSION( 3, 0 ); TEST_GLEW_VERSION( 3, 1 ); TEST_GLEW_VERSION( 3, 2 ); TEST_GLEW_VERSION( 3, 3 ); TEST_GLEW_VERSION( 4, 0 ); TEST_GLEW_VERSION( 4, 1 ); TEST_GLEW_VERSION( 4, 2 ); TEST_GLEW_VERSION( 4, 3 ); #ifdef GLEW_VERSION_4_5 TEST_GLEW_VERSION( 4, 4 ); TEST_GLEW_VERSION( 4, 5 ); #endif // Framebuffer capabilities GLboolean result; EQ_GL_CALL( glGetBooleanv( GL_STEREO, &result )); dc.stereo = result; EQ_GL_CALL( glGetBooleanv( GL_DOUBLEBUFFER, &result )); dc.doublebuffered = result; if( dc.coreProfile ) { if( getFrameBufferObject( )) { glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, &dc.stencilBits ); // eat GL error if no stencil attachment; should return '0' bits // according to spec, but gives GL_INVALID_OPERATION glGetError(); EQ_GL_CALL( glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, &dc.colorBits )); EQ_GL_CALL( glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &dc.alphaBits )); } else { EQ_GL_CALL( glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, &dc.stencilBits )); EQ_GL_CALL( glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, &dc.colorBits )); EQ_GL_CALL( glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &dc.alphaBits )); } } else { EQ_GL_CALL( glGetIntegerv( GL_STENCIL_BITS, &dc.stencilBits )); EQ_GL_CALL( glGetIntegerv( GL_RED_BITS, &dc.colorBits )); EQ_GL_CALL( glGetIntegerv( GL_ALPHA_BITS, &dc.alphaBits )); EQ_GL_CALL( glGetIntegerv( GL_ACCUM_RED_BITS, &dc.accumBits )); } dc.accumBits *= 4; LBDEBUG << "Window drawable config: " << dc << std::endl; }
void GLWindow::queryDrawableConfig( DrawableConfig& drawableConfig ) { // GL version const char* glVersion = (const char*)glGetString( GL_VERSION ); if( !glVersion ) // most likely no context - fail { LBWARN << "glGetString(GL_VERSION) returned 0, assuming GL version 1.1" << std::endl; drawableConfig.glVersion = 1.1f; } else drawableConfig.glVersion = static_cast<float>( atof( glVersion )); if( drawableConfig.glVersion >= 3.2f ) { GLint mask; EQ_GL_CALL( glGetIntegerv( GL_CONTEXT_PROFILE_MASK, &mask )); drawableConfig.coreProfile = mask & GL_CONTEXT_CORE_PROFILE_BIT; } // Framebuffer capabilities GLboolean result; EQ_GL_CALL( glGetBooleanv( GL_STEREO, &result )); drawableConfig.stereo = result; EQ_GL_CALL( glGetBooleanv( GL_DOUBLEBUFFER, &result )); drawableConfig.doublebuffered = result; GLint stencilBits, colorBits, alphaBits, accumBits; stencilBits = colorBits = alphaBits = accumBits = 0; if( drawableConfig.coreProfile ) { if( getFrameBufferObject( )) { glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, &stencilBits ); // eat GL error if no stencil attachment; should return '0' bits // according to spec, but gives GL_INVALID_OPERATION glGetError(); EQ_GL_CALL( glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, &colorBits )); EQ_GL_CALL( glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &alphaBits )); } else { EQ_GL_CALL( glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, &stencilBits )); EQ_GL_CALL( glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE, &colorBits )); EQ_GL_CALL( glGetFramebufferAttachmentParameteriv( GL_FRAMEBUFFER, GL_FRONT_LEFT, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, &alphaBits )); } } else { EQ_GL_CALL( glGetIntegerv( GL_STENCIL_BITS, &stencilBits )); EQ_GL_CALL( glGetIntegerv( GL_RED_BITS, &colorBits )); EQ_GL_CALL( glGetIntegerv( GL_ALPHA_BITS, &alphaBits )); EQ_GL_CALL( glGetIntegerv( GL_ACCUM_RED_BITS, &accumBits )); } drawableConfig.stencilBits = stencilBits; drawableConfig.colorBits = colorBits; drawableConfig.alphaBits = alphaBits; drawableConfig.accumBits = accumBits * 4; LBDEBUG << "Window drawable config: " << drawableConfig << std::endl; }