GlWindow::GlWindow()
: mWindowBase(),
- mGraphics( nullptr ),
+ mGraphics(),
+ mDisplayConnection( nullptr ),
mEventHandler( nullptr ),
mPositionSize(),
mColorDepth( COLOR_DEPTH_24 ),
mEventHandler->RemoveObserver( *this );
}
- if( Dali::Adaptor::IsAvailable() && mGLRenderCallback )
- {
- Dali::Adaptor::Get().RemoveIdle( mGLRenderCallback );
- }
-
if( mGLTerminateCallback )
{
mGLTerminateCallback();
if( mIsEGLInitialize )
{
- EglGraphics *eglGraphics = static_cast<EglGraphics*>( mGraphics );
+ GraphicsInterface* graphics = mGraphics.get();
+ EglGraphics *eglGraphics = static_cast<EglGraphics*>( graphics );
Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
if( mEGLSurface )
eglImpl.DestroyContext( mEGLContext );
mEGLContext = nullptr;
}
+
+ eglImpl.TerminateGles();
+
+ mGraphics->Destroy();
}
}
bool GlWindow::RunCallback()
{
- EglGraphics *eglGraphics = static_cast<EglGraphics*>( mGraphics );
+ GraphicsInterface* graphics = mGraphics.get();
+ EglGraphics *eglGraphics = static_cast<EglGraphics*>( graphics );
Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
eglImpl.MakeContextCurrent( mEGLSurface, mEGLContext );
{
if( !mIsEGLInitialize )
{
- mGraphics = &( Adaptor::GetImplementation( Adaptor::Get() ).GetGraphicsInterface() );
- EglGraphics *eglGraphics = static_cast<EglGraphics *>(mGraphics);
- Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
+ // Init Graphics
+ std::unique_ptr< GraphicsFactory > graphicsFactoryPtr = Utils::MakeUnique< GraphicsFactory >();
+ auto graphicsFactory = *graphicsFactoryPtr.get();
+
+ mGraphics = std::unique_ptr< GraphicsInterface >( &graphicsFactory.Create() );
+ GraphicsInterface* graphics = mGraphics.get();
+ EglGraphics *eglGraphics = static_cast<EglGraphics*>( graphics );
+ eglGraphics->Initialize( mDepth, mStencil, mMSAA );
+ eglGraphics->Create();
+ mDisplayConnection = std::unique_ptr< Dali::DisplayConnection >( Dali::DisplayConnection::New( *graphics, Dali::RenderSurfaceInterface::Type::WINDOW_RENDER_SURFACE ) );
+ mDisplayConnection->Initialize();
+
+ Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation();
if( mGLESVersion == Dali::GlWindow::GlesVersion::VERSION_2_0 )
{
eglImpl.SetGlesVersion( 20 );