From 869f5e64c733a53cb8671232287a09bfafcbb1c6 Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 16 May 2010 07:37:22 +0000 Subject: [PATCH] Added a catch-all OpenGL visual. This allows the VideoSoftware plug-in to run under VirtualBox. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5454 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp | 25 +++++++++++++++-- .../Plugin_VideoSoftware/Src/GLUtil.cpp | 27 +++++++++++++++++-- 2 files changed, 48 insertions(+), 4 deletions(-) diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index 184ee657a9..210fc2c140 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -347,6 +347,14 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight GLX_DEPTH_SIZE, 24, GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode, GLX_SAMPLES_ARB, 1, None }; + int attrListDefault[] = { + GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + GLX_DEPTH_SIZE, 1, + None }; GLWin.dpy = XOpenDisplay(0); GLWin.parent = (Window)g_VideoInitialize.pWindowHandle; @@ -361,9 +369,22 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight /* get an appropriate visual */ GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDbl); - if (GLWin.vi == NULL) { + if (GLWin.vi == NULL) + { GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListSgl); - ERROR_LOG(VIDEO, "Only Singlebuffered Visual!"); + if (GLWin.vi != NULL) + { + ERROR_LOG(VIDEO, "Only Singlebuffered Visual!"); + } + else + { + GLWin.vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDefault); + if (GLWin.vi == NULL) + { + ERROR_LOG(VIDEO, "Could not choose visual (glXChooseVisual)"); + exit(0); + } + } } else NOTICE_LOG(VIDEO, "Got Doublebuffered Visual!"); diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp index b56926ab63..fb74ce1abf 100644 --- a/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoSoftware/Src/GLUtil.cpp @@ -271,6 +271,16 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 24, GLX_SAMPLE_BUFFERS_ARB, GLX_SAMPLES_ARB, 1, None }; + + int attrListDefault[] = { + GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + GLX_DEPTH_SIZE, 1, + None }; + GLWin.dpy = XOpenDisplay(0); GLWin.parent = (Window)g_VideoInitialize.pWindowHandle; g_VideoInitialize.pWindowHandle = (HWND)GLWin.dpy; @@ -278,9 +288,22 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight /* get an appropriate visual */ vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDbl); - if (vi == NULL) { + if (vi == NULL) + { vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListSgl); - ERROR_LOG(VIDEO, "Only Singlebuffered Visual!"); + if (vi != NULL) + { + ERROR_LOG(VIDEO, "Only Singlebuffered Visual!"); + } + else + { + vi = glXChooseVisual(GLWin.dpy, GLWin.screen, attrListDefault); + if (vi == NULL) + { + ERROR_LOG(VIDEO, "Could not choose visual (glXChooseVisual)"); + exit(0); + } + } } else NOTICE_LOG(VIDEO, "Got Doublebuffered Visual!");