summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorRobert Campbell <waprave@gmail.com>2020-01-30 09:39:19 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-02-02 21:26:20 +0000
commitdadb44ef46cb83a957507a1d2d5d20986b3cec22 (patch)
treec3bb3f99b63116a256d5a2a255b9256cc879974a /Graphics/GraphicsEngineOpenGL
parentMinor update in GL backend (diff)
downloadDiligentCore-dadb44ef46cb83a957507a1d2d5d20986b3cec22.tar.gz
DiligentCore-dadb44ef46cb83a957507a1d2d5d20986b3cec22.zip
Introduced NativeWindow wrapper for supported platforms
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp8
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp6
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/SwapChainGLIOS.mm2
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp6
7 files changed, 14 insertions, 14 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp
index 54787d46..705124eb 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp
@@ -237,7 +237,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa
major_version_(0),
minor_version_(0)
{
- auto* NativeWindow = reinterpret_cast<ANativeWindow*>(InitAttribs.pNativeWndHandle);
+ auto* NativeWindow = reinterpret_cast<ANativeWindow*>(InitAttribs.Window.pAWindow);
Init(NativeWindow);
FillDeviceCaps(deviceCaps);
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm b/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm
index 3381698c..25310e74 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm
+++ b/Graphics/GraphicsEngineOpenGL/src/GLContextIOS.mm
@@ -46,7 +46,7 @@ namespace Diligent
//Or better yet, use the GL3 way to get the version number
glGetIntegerv( GL_MAJOR_VERSION, &MajorVersion );
glGetIntegerv( GL_MINOR_VERSION, &MinorVersion );
- LOG_INFO_MESSAGE(Info.pNativeWndHandle != nullptr ? "Initialized OpenGLES " : "Attached to OpenGLES ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')');
+ LOG_INFO_MESSAGE(Info.Window.pNSView != nullptr ? "Initialized OpenGLES " : "Attached to OpenGLES ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')');
// Under the standard filtering rules for cubemaps, filtering does not work across faces of the cubemap.
// This results in a seam across the faces of a cubemap. This was a hardware limitation in the past, but
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp
index ce27deb7..8a3174fe 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/GLContextLinux.cpp
@@ -87,8 +87,8 @@ void openglCallbackFunction(GLenum source,
GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCaps, const struct SwapChainDesc* /*pSCDesc*/) :
m_Context(0),
- m_pNativeWindow(InitAttribs.pNativeWndHandle),
- m_pDisplay(InitAttribs.pDisplay)
+ m_pNativeWindow(InitAttribs.Window.pWindow),
+ m_pDisplay(InitAttribs.Window.pDisplay)
{
auto CurrentCtx = glXGetCurrentContext();
if (CurrentCtx == 0)
@@ -101,7 +101,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa
if (GLEW_OK != err)
LOG_ERROR_AND_THROW("Failed to initialize GLEW");
- if (InitAttribs.pNativeWndHandle != nullptr && InitAttribs.pDisplay != nullptr)
+ if (InitAttribs.Window.pWindow != nullptr && InitAttribs.Window.pDisplay != nullptr)
{
//glXSwapIntervalEXT(0);
@@ -127,7 +127,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa
//Or better yet, use the GL3 way to get the version number
glGetIntegerv(GL_MAJOR_VERSION, &MajorVersion);
glGetIntegerv(GL_MINOR_VERSION, &MinorVersion);
- LOG_INFO_MESSAGE(InitAttribs.pNativeWndHandle != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')');
+ LOG_INFO_MESSAGE(InitAttribs.Window.pWindow != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')');
// Under the standard filtering rules for cubemaps, filtering does not work across faces of the cubemap.
// This results in a seam across the faces of a cubemap. This was a hardware limitation in the past, but
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm b/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm
index 56bb5d22..35418f6b 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm
+++ b/Graphics/GraphicsEngineOpenGL/src/GLContextMacOS.mm
@@ -74,7 +74,7 @@ namespace Diligent
//Or better yet, use the GL3 way to get the version number
glGetIntegerv( GL_MAJOR_VERSION, &MajorVersion );
glGetIntegerv( GL_MINOR_VERSION, &MinorVersion );
- LOG_INFO_MESSAGE(InitAttribs.pNativeWndHandle != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')');
+ LOG_INFO_MESSAGE(InitAttribs.Window.pNSWindow != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ", ", GLRenderer, ')');
// Under the standard filtering rules for cubemaps, filtering does not work across faces of the cubemap.
// This results in a seam across the faces of a cubemap. This was a hardware limitation in the past, but
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp
index 2bfd7d9d..2aef9128 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/GLContextWindows.cpp
@@ -104,9 +104,9 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa
m_WindowHandleToDeviceContext{0}
{
Int32 MajorVersion = 0, MinorVersion = 0;
- if (InitAttribs.pNativeWndHandle != nullptr)
+ if (InitAttribs.Window.hWnd != nullptr)
{
- HWND hWnd = reinterpret_cast<HWND>(InitAttribs.pNativeWndHandle);
+ HWND hWnd = reinterpret_cast<HWND>(InitAttribs.Window.hWnd);
// See http://www.opengl.org/wiki/Tutorial:_OpenGL_3.1_The_First_Triangle_(C%2B%2B/Win)
// http://www.opengl.org/wiki/Creating_an_OpenGL_Context_(WGL)
@@ -273,7 +273,7 @@ GLContext::GLContext(const EngineGLCreateInfo& InitAttribs, DeviceCaps& deviceCa
//Or better yet, use the GL3 way to get the version number
glGetIntegerv(GL_MAJOR_VERSION, &MajorVersion);
glGetIntegerv(GL_MINOR_VERSION, &MinorVersion);
- LOG_INFO_MESSAGE(InitAttribs.pNativeWndHandle != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ')');
+ LOG_INFO_MESSAGE(InitAttribs.Window.hWnd != nullptr ? "Initialized OpenGL " : "Attached to OpenGL ", MajorVersion, '.', MinorVersion, " context (", GLVersionString, ')');
// Under the standard filtering rules for cubemaps, filtering does not work across faces of the cubemap.
// This results in a seam across the faces of a cubemap. This was a hardware limitation in the past, but
diff --git a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLIOS.mm b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLIOS.mm
index c2a95ed0..a7b64e7a 100644
--- a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLIOS.mm
+++ b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLIOS.mm
@@ -43,7 +43,7 @@ SwapChainGLIOS::SwapChainGLIOS(IReferenceCounters* pRefCounters,
m_DepthRenderBuffer(false),
m_DefaultFBO(false)
{
- m_CALayer = InitAttribs.pNativeWndHandle;
+ m_CALayer = InitAttribs.Window.pNSView;
InitRenderBuffers(true, m_SwapChainDesc.Width, m_SwapChainDesc.Height);
CreateDummyBuffers(m_pRenderDevice.RawPtr<RenderDeviceGLImpl>());
}
diff --git a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp
index 6245c02e..4c98b44b 100644
--- a/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/SwapChainGLImpl.cpp
@@ -48,14 +48,14 @@ SwapChainGLImpl::SwapChainGLImpl(IReferenceCounters* pRefCounters,
// clang-format on
{
#if PLATFORM_WIN32
- HWND hWnd = reinterpret_cast<HWND>(InitAttribs.pNativeWndHandle);
+ HWND hWnd = reinterpret_cast<HWND>(InitAttribs.Window.hWnd);
RECT rc;
GetClientRect(hWnd, &rc);
m_SwapChainDesc.Width = rc.right - rc.left;
m_SwapChainDesc.Height = rc.bottom - rc.top;
#elif PLATFORM_LINUX
- auto wnd = static_cast<Window>(reinterpret_cast<size_t>(InitAttribs.pNativeWndHandle));
- auto display = reinterpret_cast<Display*>(InitAttribs.pDisplay);
+ auto wnd = static_cast<Window>(reinterpret_cast<size_t>(InitAttribs.Window.pWindow));
+ auto display = reinterpret_cast<Display*>(InitAttribs.Window.pDisplay);
XWindowAttributes XWndAttribs;
XGetWindowAttributes(display, wnd, &XWndAttribs);