summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinWX/GLInterface/GLX.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2014-08-21 14:14:54 -0400
committerLioncash <mathew1800@gmail.com>2014-08-21 14:14:54 -0400
commitf17dcd201906c33074d5979390768ed74eb9709f (patch)
treeab06743826b4f8a6c7e90ad32edc7b75a6410a6e /Source/Core/DolphinWX/GLInterface/GLX.cpp
parentcf82972961baa120675fa038b82cf99c8404ab1b (diff)
parent6dbafa92389f52c6bd0140b4525b563fe74af0f2 (diff)
Merge pull request #764 from magcius/new-nogui-2
Rewrite GLInterface
Diffstat (limited to 'Source/Core/DolphinWX/GLInterface/GLX.cpp')
-rw-r--r--Source/Core/DolphinWX/GLInterface/GLX.cpp57
1 files changed, 24 insertions, 33 deletions
diff --git a/Source/Core/DolphinWX/GLInterface/GLX.cpp b/Source/Core/DolphinWX/GLInterface/GLX.cpp
index 320d0f884a..acfcab6a69 100644
--- a/Source/Core/DolphinWX/GLInterface/GLX.cpp
+++ b/Source/Core/DolphinWX/GLInterface/GLX.cpp
@@ -4,7 +4,7 @@
#include <string>
-#include "DolphinWX/GLInterface/GLInterface.h"
+#include "DolphinWX/GLInterface/GLX.h"
#include "VideoCommon/RenderBase.h"
#include "VideoCommon/VideoConfig.h"
@@ -12,12 +12,6 @@
typedef int ( * PFNGLXSWAPINTERVALSGIPROC) (int interval);
static PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI = nullptr;
-// Show the current FPS
-void cInterfaceGLX::UpdateFPSDisplay(const std::string& text)
-{
- XStoreName(GLWin.evdpy, GLWin.win, text.c_str());
-}
-
void cInterfaceGLX::SwapInterval(int Interval)
{
if (glXSwapIntervalSGI)
@@ -32,12 +26,12 @@ void* cInterfaceGLX::GetFuncAddress(const std::string& name)
void cInterfaceGLX::Swap()
{
- glXSwapBuffers(GLWin.dpy, GLWin.win);
+ glXSwapBuffers(dpy, win);
}
// Create rendering window.
// Call browser: Core.cpp:EmuThread() > main.cpp:Video_Initialize()
-bool cInterfaceGLX::Create(void *&window_handle)
+bool cInterfaceGLX::Create(void *window_handle)
{
int glxMajorVersion, glxMinorVersion;
@@ -64,29 +58,25 @@ bool cInterfaceGLX::Create(void *&window_handle)
GLX_DOUBLEBUFFER,
None };
- GLWin.dpy = XOpenDisplay(nullptr);
- GLWin.evdpy = XOpenDisplay(nullptr);
- GLWin.parent = (Window)window_handle;
- GLWin.screen = DefaultScreen(GLWin.dpy);
- if (GLWin.parent == 0)
- GLWin.parent = RootWindow(GLWin.dpy, GLWin.screen);
+ dpy = XOpenDisplay(nullptr);
+ int screen = DefaultScreen(dpy);
- glXQueryVersion(GLWin.dpy, &glxMajorVersion, &glxMinorVersion);
+ glXQueryVersion(dpy, &glxMajorVersion, &glxMinorVersion);
NOTICE_LOG(VIDEO, "glX-Version %d.%d", glxMajorVersion, glxMinorVersion);
// Get an appropriate visual
- GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDbl);
- if (GLWin.vi == nullptr)
+ vi = glXChooseVisual(dpy, screen, attrListDbl);
+ if (vi == nullptr)
{
- GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListSgl);
- if (GLWin.vi != nullptr)
+ vi = glXChooseVisual(dpy, screen, attrListSgl);
+ if (vi != nullptr)
{
ERROR_LOG(VIDEO, "Only single buffered visual!");
}
else
{
- GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDefault);
- if (GLWin.vi == nullptr)
+ vi = glXChooseVisual(dpy, screen, attrListDefault);
+ if (vi == nullptr)
{
ERROR_LOG(VIDEO, "Could not choose visual (glXChooseVisual)");
return false;
@@ -97,21 +87,23 @@ bool cInterfaceGLX::Create(void *&window_handle)
NOTICE_LOG(VIDEO, "Got double buffered visual!");
// Create a GLX context.
- GLWin.ctx = glXCreateContext(GLWin.dpy, GLWin.vi, nullptr, GL_TRUE);
- if (!GLWin.ctx)
+ ctx = glXCreateContext(dpy, vi, nullptr, GL_TRUE);
+ if (!ctx)
{
PanicAlert("Unable to create GLX context.");
return false;
}
- XWindow.CreateXWindow();
- window_handle = (void *)GLWin.win;
+ XWindow.Initialize(dpy);
+
+ Window parent = (Window)window_handle;
+ win = XWindow.CreateXWindow(parent, vi);
return true;
}
bool cInterfaceGLX::MakeCurrent()
{
- bool success = glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
+ bool success = glXMakeCurrent(dpy, win, ctx);
if (success)
{
// load this function based on the current bound context
@@ -122,7 +114,7 @@ bool cInterfaceGLX::MakeCurrent()
bool cInterfaceGLX::ClearCurrent()
{
- return glXMakeCurrent(GLWin.dpy, None, nullptr);
+ return glXMakeCurrent(dpy, None, nullptr);
}
@@ -130,12 +122,11 @@ bool cInterfaceGLX::ClearCurrent()
void cInterfaceGLX::Shutdown()
{
XWindow.DestroyXWindow();
- if (GLWin.ctx)
+ if (ctx)
{
- glXDestroyContext(GLWin.dpy, GLWin.ctx);
- XCloseDisplay(GLWin.dpy);
- XCloseDisplay(GLWin.evdpy);
- GLWin.ctx = nullptr;
+ glXDestroyContext(dpy, ctx);
+ XCloseDisplay(dpy);
+ ctx = nullptr;
}
}