mContext( nullptr ),
mWidth( mSurface->GetPositionSize().width ),
mHeight( mSurface->GetPositionSize().height ),
- mBackgroundColor( 0.f, 0.f, 0.f, 1.f ),
mSizeChanged( false ),
mIsSurfaceInvalid( false )
{
void SurfaceFrameBuffer::Destroy( Context& context )
{
- if ( mSurface && !mIsSurfaceInvalid )
+ if ( IsSurfaceValid() )
{
mSurface->DestroySurface();
mSurface = nullptr;
mContext->GlContextDestroyed();
}
- if ( mSurface && !mIsSurfaceInvalid )
+ if ( IsSurfaceValid() )
{
mSurface->DestroySurface();
mSurface = nullptr;
mContext = &context;
mContext->GlContextCreated();
- if ( mSurface && !mIsSurfaceInvalid )
+ if ( IsSurfaceValid() )
{
mSurface->InitializeGraphics();
}
void SurfaceFrameBuffer::Bind( Context& context )
{
- if ( mSurface && !mIsSurfaceInvalid )
+ if ( IsSurfaceValid() )
{
mSurface->PreRender( mSizeChanged );
void SurfaceFrameBuffer::PostRender()
{
- if ( mSurface && !mIsSurfaceInvalid )
+ if ( IsSurfaceValid() )
{
mSurface->PostRender( false, false, mSizeChanged );
}
return mContext;
}
-Integration::DepthBufferAvailable SurfaceFrameBuffer::GetDepthBufferRequired()
+void SurfaceFrameBuffer::MakeContextCurrent()
{
- return mSurface && !mIsSurfaceInvalid ? Integration::DepthBufferAvailable::FALSE : mSurface->GetDepthBufferRequired();
-}
-
-Integration::StencilBufferAvailable SurfaceFrameBuffer::GetStencilBufferRequired()
-{
- return mSurface && !mIsSurfaceInvalid ? Integration::StencilBufferAvailable::TRUE : mSurface->GetStencilBufferRequired();
-}
-
-Vector4 SurfaceFrameBuffer::GetBackgroundColor()
-{
- return mBackgroundColor;
+ if ( IsSurfaceValid() )
+ {
+ mSurface->MakeContextCurrent();
+ }
}
void SurfaceFrameBuffer::SetSize( uint32_t width, uint32_t height )
mSizeChanged = true;
}
-void SurfaceFrameBuffer::SetBackgroundColor( const Vector4& color )
+bool SurfaceFrameBuffer::IsSurfaceValid() const
{
- mBackgroundColor = color;
+ return mSurface && !mIsSurfaceInvalid;
}
} //Render