- if ( surfaceOrientation == 90 || surfaceOrientation == 270 )
- {
- int temp = viewportRect.width;
- viewportRect.width = viewportRect.height;
- viewportRect.height = temp;
- }
-
- mImpl->currentContext->Viewport(viewportRect.x, viewportRect.y, viewportRect.width, viewportRect.height);
-
- if ( instruction.mIsClearColorSet )
- {
- mImpl->currentContext->ClearColor( clearColor.r,
- clearColor.g,
- clearColor.b,
- clearColor.a );
-
- // Clear the viewport area only
- mImpl->currentContext->SetScissorTest( true );
- mImpl->currentContext->Scissor( viewportRect.x, viewportRect.y, viewportRect.width, viewportRect.height );
- mImpl->currentContext->ColorMask( true );
- mImpl->currentContext->Clear( GL_COLOR_BUFFER_BIT , Context::CHECK_CACHED_VALUES );
- mImpl->currentContext->SetScissorTest( false );
- }
-
- // Clear the list of bound textures
- mImpl->boundTextures.Clear();
-
- mImpl->renderAlgorithms.ProcessRenderInstruction(
- instruction,
- *mImpl->currentContext,
- mImpl->renderBufferIndex,
- depthBufferAvailable,
- stencilBufferAvailable,
- mImpl->boundTextures,
- surfaceOrientation );
+ bool clearFullFrameRect = true;
+ if( instruction.mFrameBuffer != 0 )
+ {
+ Viewport frameRect( 0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight() );
+ clearFullFrameRect = ( frameRect == viewportRect );
+ }
+ else
+ {
+ clearFullFrameRect = ( surfaceRect == viewportRect );
+ }