Commit b102894e authored by Matt Clarkson's avatar Matt Clarkson

Fixed various scissor issues.

parent 7bec814a
......@@ -362,6 +362,7 @@ void VividRenderer::renderControl(const RenderQueue* render_queue, Camera* camer
void VividRenderer::renderStencil(Camera* camera) {
VL_CHECK_OGL();
VL_CHECK( mStencilFBO );
VL_CHECK( glIsEnabled( GL_SCISSOR_TEST ) );
// Bind Stencil Texture Framebuffer Object
......@@ -374,6 +375,7 @@ void VividRenderer::renderStencil(Camera* camera) {
// Clear color buffer
glDisable( GL_SCISSOR_TEST );
glClearColor( 0, 0, 0, 1 ); VL_CHECK_OGL();
glClear( GL_COLOR_BUFFER_BIT ); VL_CHECK_OGL();
......@@ -420,6 +422,7 @@ void VividRenderer::renderStencil(Camera* camera) {
glBindFramebuffer( GL_FRAMEBUFFER, 0 ); VL_CHECK_OGL();
glReadBuffer( GL_BACK ); VL_CHECK_OGL();
glDrawBuffer( GL_BACK ); VL_CHECK_OGL();
glEnable( GL_SCISSOR_TEST );
}
//-------------------------------------------------------------------------------------------------
void VividRenderer::renderFrontToBackPeeling(const RenderQueue* render_queue, Camera* camera, real frame_clock)
......@@ -571,16 +574,17 @@ void VividRenderer::renderFrontToBackPeeling(const RenderQueue* render_queue, Ca
glDepthMask( GL_FALSE );
// clear & render the background
// don't clip the background against the scissor
// scissor disabled: clear entire window, not just viewport and don't clip background against scissor/viewport.
VL_CHECK( camera->viewport()->isScissorEnabled() );
camera->viewport()->setScissorEnabled( false );
camera->viewport()->setClearFlags( CF_CLEAR_COLOR_DEPTH );
camera->viewport()->activate();
if ( mVividRendering->backgroundImageEnabled() ) {
renderBackgroundImage( camera );
}
camera->viewport()->setScissorEnabled( true );
glDisable( GL_SCISSOR_TEST );
vec4 bgc = camera->viewport()->clearColor();
glClearColor( bgc.r(), bgc.g(), bgc.b(), bgc.a() );
glClearDepth( camera->viewport()->clearDepth() );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
if ( mVividRendering->backgroundImageEnabled() ) {
renderBackgroundImage( camera );
}
glEnable( GL_SCISSOR_TEST );
glEnable( GL_BLEND );
glBlendEquation( GL_FUNC_ADD );
......@@ -725,12 +729,11 @@ void VividRenderer::render2DOutlines(const RenderQueue* render_queue, Camera* ca
glDisable( GL_BLEND );
glUseProgram( 0 );
// white: outside the scissor so we don't get the `capping` effect
if( glIsEnabled( GL_SCISSOR_TEST ) ) {
glDisable( GL_SCISSOR_TEST );
VL_CHECK( glIsEnabled( GL_SCISSOR_TEST ) );
glDisable( GL_SCISSOR_TEST );
glClearColor( 1, 1, 1, 1 );
glClear( GL_COLOR_BUFFER_BIT );
glEnable( GL_SCISSOR_TEST );
}
glEnable( GL_SCISSOR_TEST );
// black: inside the scissor
glClearColor( 0, 0, 0, 0 );
glClear( GL_COLOR_BUFFER_BIT );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment