diff --git a/src/RenderLibrary/CreateDirectXDevice.cpp b/src/RenderLibrary/CreateDirectXDevice.cpp index 88e3abb..cd52560 100644 --- a/src/RenderLibrary/CreateDirectXDevice.cpp +++ b/src/RenderLibrary/CreateDirectXDevice.cpp @@ -78,12 +78,17 @@ void DirectXRenderObject::CleanupDirectX() InlineResourcesRelease(&_directXRenderProperties._g_pd3dDevice); } -bool DirectXRenderObject::RenderDirectXFrame() +bool DirectXRenderObject::BeginDirectXFrame() { FLOAT clearColor[4] = { 0.1f, 0.1f, 0.1f, 1.0f }; - _directXRenderProperties._g_pImmediateContext->ClearRenderTargetView(_directXRenderProperties._g_pRenderTargetView, clearColor); - _directXRenderProperties._g_pSwapChain->Present(0, 0); + + return true; +} + +bool DirectXRenderObject::EndDirectXFrame() +{ + _directXRenderProperties._g_pSwapChain->Present(1, 0); return true; } diff --git a/src/RenderLibrary/CreateDirectXDevice.hpp b/src/RenderLibrary/CreateDirectXDevice.hpp index d135ce8..62d7659 100644 --- a/src/RenderLibrary/CreateDirectXDevice.hpp +++ b/src/RenderLibrary/CreateDirectXDevice.hpp @@ -10,7 +10,8 @@ namespace RenderLibary void CreateDirectXScene(HWND hwnd); void CleanupDirectX(); - bool RenderDirectXFrame(); + bool BeginDirectXFrame(); + bool EndDirectXFrame(); protected: struct diff --git a/src/RenderLibrary/FabricCustomWindow.cpp b/src/RenderLibrary/FabricCustomWindow.cpp index d68701d..3e7c6fa 100644 --- a/src/RenderLibrary/FabricCustomWindow.cpp +++ b/src/RenderLibrary/FabricCustomWindow.cpp @@ -139,7 +139,10 @@ API bool FrameCustom() if (_renderCustomObject._b_ShouldExit) return false; - if (!_directXRenderObject->RenderDirectXFrame()) + if (!_directXRenderObject->BeginDirectXFrame()) + return false; + + if (!_directXRenderObject->EndDirectXFrame()) return false; return true; diff --git a/src/RenderLibrary/FabricNativeWindow.cpp b/src/RenderLibrary/FabricNativeWindow.cpp index 5c1957b..6e820c8 100644 --- a/src/RenderLibrary/FabricNativeWindow.cpp +++ b/src/RenderLibrary/FabricNativeWindow.cpp @@ -139,7 +139,10 @@ API bool FrameNative(bool show) if (_renderNativeObject._b_ShouldExit) return false; - if (!_directXRenderObject->RenderDirectXFrame()) + if (!_directXRenderObject->BeginDirectXFrame()) + return false; + + if (!_directXRenderObject->EndDirectXFrame()) return false; }