OGL:
Kill not working sdl backend remove some wxgl code change defined a bit so resolution detection can be done right with wxgl and X11 git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4239 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
bc6323ea0e
commit
e0dfe17ca4
13
SConstruct
13
SConstruct
|
@ -107,7 +107,6 @@ vars.AddVariables(
|
|||
BoolVariable('lint', 'Set for lint build (extra warnings)', False),
|
||||
BoolVariable('nowx', 'Set For Building with no WX libs (WIP)', False),
|
||||
BoolVariable('wxgl', 'Set For Building with WX GL libs (WIP)', False),
|
||||
BoolVariable('sdlgl', 'Set For Building with SDL GL libs (WIP)', False),
|
||||
BoolVariable('jittest', 'temp don\'t use (WIP)', False),
|
||||
BoolVariable('nojit', 'Remove entire jit cores', False),
|
||||
EnumVariable('flavor', 'Choose a build flavor', 'release',
|
||||
|
@ -280,8 +279,6 @@ env['USE_WX'] = 0
|
|||
if env['wxgl']:
|
||||
wxmods.append('gl')
|
||||
env['USE_WX'] = 1
|
||||
env['HAVE_X11'] = 0
|
||||
env['HAVE_COCOA'] = 0
|
||||
|
||||
if sys.platform == 'win32':
|
||||
env['HAVE_WX'] = 1
|
||||
|
@ -293,15 +290,6 @@ if env['nowx']:
|
|||
else:
|
||||
env['HAVE_WX'] = conf.CheckWXConfig('2.8', wxmods, 0)
|
||||
|
||||
# SDL backend
|
||||
env['USE_SDL'] = 0
|
||||
|
||||
if env['sdlgl']:
|
||||
env['USE_SDL'] = 1
|
||||
env['HAVE_X11'] = 0
|
||||
env['HAVE_COCOA'] = 0
|
||||
env['USE_WX'] = 0
|
||||
|
||||
env['JITTEST'] = 0
|
||||
if env['jittest']:
|
||||
env['JITTEST'] = 1
|
||||
|
@ -315,7 +303,6 @@ conf.Define('NOJIT', env['NOJIT'])
|
|||
|
||||
# Creating config.h defines
|
||||
conf.Define('HAVE_SDL', env['HAVE_SDL'])
|
||||
conf.Define('USE_SDL', env['USE_SDL'])
|
||||
conf.Define('HAVE_BLUEZ', env['HAVE_BLUEZ'])
|
||||
conf.Define('HAVE_AO', env['HAVE_AO'])
|
||||
conf.Define('HAVE_OPENAL', env['HAVE_OPENAL'])
|
||||
|
|
|
@ -53,14 +53,13 @@ extern HINSTANCE g_hInstance;
|
|||
|
||||
void OpenGL_SwapBuffers()
|
||||
{
|
||||
#if USE_SDL
|
||||
SDL_GL_SwapBuffers();
|
||||
#if defined(USE_WX) && USE_WX
|
||||
GLWin.glCanvas->SwapBuffers();
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
cocoaGLSwap(GLWin.cocoaCtx,GLWin.cocoaWin);
|
||||
#elif defined(_WIN32)
|
||||
SwapBuffers(hDC);
|
||||
#elif defined(USE_WX) && USE_WX
|
||||
GLWin.glCanvas->SwapBuffers();
|
||||
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
glXSwapBuffers(GLWin.dpy, GLWin.win);
|
||||
#endif
|
||||
|
@ -78,15 +77,13 @@ u32 OpenGL_GetBackbufferHeight()
|
|||
|
||||
void OpenGL_SetWindowText(const char *text)
|
||||
{
|
||||
#if USE_SDL
|
||||
SDL_WM_SetCaption(text, NULL);
|
||||
#if defined(USE_WX) && USE_WX
|
||||
GLWin.frame->SetTitle(wxString::FromAscii(text));
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
cocoaGLSetTitle(GLWin.cocoaWin, text);
|
||||
#elif defined(_WIN32)
|
||||
// TODO convert text to unicode and change SetWindowTextA to SetWindowText
|
||||
SetWindowTextA(EmuWindow::GetWnd(), text);
|
||||
#elif defined(USE_WX) && USE_WX
|
||||
GLWin.frame->SetTitle(wxString::FromAscii(text));
|
||||
#elif defined(HAVE_X11) && HAVE_X11 // GLX
|
||||
/**
|
||||
* Tell X to ask the window manager to set the window title. (X
|
||||
|
@ -96,9 +93,7 @@ void OpenGL_SetWindowText(const char *text)
|
|||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================================
|
||||
// Draw messages on top of the screen
|
||||
// ------------------
|
||||
unsigned int Callback_PeekMessages()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
|
@ -168,22 +163,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
|
||||
g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
|
||||
|
||||
#if USE_SDL
|
||||
//init sdl video
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
|
||||
//TODO : Display an error message
|
||||
SDL_Quit();
|
||||
return false;
|
||||
}
|
||||
|
||||
//setup ogl to use double buffering
|
||||
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
GLWin.width = s_backbuffer_width;
|
||||
GLWin.height = s_backbuffer_height;
|
||||
GLWin.cocoaWin = cocoaGLCreateWindow(GLWin.width, GLWin.height);
|
||||
GLWin.cocoaCtx = cocoaGLInit(g_Config.iMultisampleMode);
|
||||
#elif defined(USE_WX) && USE_WX
|
||||
#if defined(USE_WX) && USE_WX
|
||||
int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0};
|
||||
|
||||
wxSize size(_iwidth, _iheight);
|
||||
|
@ -196,23 +176,19 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||
-1, _("Dolphin"), wxPoint(50,50), size);
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
GLWin.glCanvas = new wxGLCanvas(GLWin.frame, wxID_ANY, wxPoint(0,0), size, 0, wxT("Dolphin"), args, wxNullPalette);
|
||||
#else
|
||||
GLWin.glCanvas = new wxGLCanvas(GLWin.frame, wxID_ANY, args,
|
||||
wxPoint(0,0), size, wxSUNKEN_BORDER);
|
||||
GLWin.glCtxt = new wxGLContext(GLWin.glCanvas);
|
||||
#endif
|
||||
|
||||
GLWin.frame->Show(TRUE);
|
||||
GLWin.glCanvas->Show(TRUE);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
GLWin.glCanvas->SetCurrent();
|
||||
#else
|
||||
GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
|
||||
#endif
|
||||
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
GLWin.width = s_backbuffer_width;
|
||||
GLWin.height = s_backbuffer_height;
|
||||
GLWin.cocoaWin = cocoaGLCreateWindow(GLWin.width, GLWin.height);
|
||||
GLWin.cocoaCtx = cocoaGLInit(g_Config.iMultisampleMode);
|
||||
|
||||
#elif defined(_WIN32)
|
||||
// Create rendering window in Windows
|
||||
|
@ -471,36 +447,8 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||
|
||||
bool OpenGL_MakeCurrent()
|
||||
{
|
||||
#if USE_SDL
|
||||
// Note: The reason for having the call to SDL_SetVideoMode in here instead
|
||||
// of in OpenGL_Create() is that "make current" is part of the video
|
||||
// mode setting and is not available as a separate call in SDL. We
|
||||
// have to do "make current" here because this method runs in the CPU
|
||||
// thread while OpenGL_Create() runs in a diferent thread and "make
|
||||
// current" has to be done in the same thread that will be making
|
||||
// calls to OpenGL.
|
||||
|
||||
// Fetch video info.
|
||||
const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo();
|
||||
if (!videoInfo) {
|
||||
// TODO: Display an error message.
|
||||
SDL_Quit();
|
||||
return false;
|
||||
}
|
||||
// Compute video mode flags.
|
||||
const int videoFlags = SDL_OPENGL
|
||||
| ( videoInfo->hw_available ? SDL_HWSURFACE : SDL_SWSURFACE )
|
||||
| ( g_Config.bFullscreen ? SDL_FULLSCREEN : 0);
|
||||
// Set vide mode.
|
||||
// TODO: Can we use this field or is a separate field needed?
|
||||
int _twidth = s_backbuffer_width;
|
||||
int _theight = s_backbuffer_height;
|
||||
SDL_Surface *screen = SDL_SetVideoMode(_twidth, _theight, 0, videoFlags);
|
||||
if (!screen) {
|
||||
//TODO : Display an error message
|
||||
SDL_Quit();
|
||||
return false;
|
||||
}
|
||||
#if defined(USE_WX) && USE_WX
|
||||
GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
|
||||
#elif defined(_WIN32)
|
||||
|
@ -508,13 +456,6 @@ bool OpenGL_MakeCurrent()
|
|||
PanicAlert("(5) Can't Activate The GL Rendering Context.");
|
||||
return false;
|
||||
}
|
||||
#elif defined(USE_WX) && USE_WX
|
||||
#if defined(__APPLE__)
|
||||
GLWin.glCanvas->SetCurrent();
|
||||
#else
|
||||
GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
|
||||
#endif
|
||||
return true;
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
Window winDummy;
|
||||
unsigned int borderDummy;
|
||||
|
@ -537,33 +478,21 @@ bool OpenGL_MakeCurrent()
|
|||
}
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Update window width, size and etc. Called from Render.cpp
|
||||
// ----------------
|
||||
void OpenGL_Update()
|
||||
{
|
||||
#if USE_SDL
|
||||
SDL_Surface *surface = SDL_GetVideoSurface();
|
||||
#if defined(USE_WX) && USE_WX
|
||||
RECT rcWindow = {0};
|
||||
if (!surface)
|
||||
return;
|
||||
s_backbuffer_width = surface->w;
|
||||
s_backbuffer_height = surface->h;
|
||||
|
||||
rcWindow.right = surface->w;
|
||||
rcWindow.bottom = surface->h;
|
||||
rcWindow.right = GLWin.width;
|
||||
rcWindow.bottom = GLWin.height;
|
||||
|
||||
// TODO fill in
|
||||
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
RECT rcWindow = {0};
|
||||
rcWindow.right = GLWin.width;
|
||||
rcWindow.bottom = GLWin.height;
|
||||
|
||||
#elif defined(USE_WX) && USE_WX
|
||||
RECT rcWindow = {0};
|
||||
rcWindow.right = GLWin.width;
|
||||
rcWindow.bottom = GLWin.height;
|
||||
|
||||
// TODO fill in
|
||||
#elif defined(_WIN32)
|
||||
RECT rcWindow;
|
||||
if (!EmuWindow::GetParentWnd())
|
||||
|
@ -664,18 +593,15 @@ void OpenGL_Update()
|
|||
}
|
||||
|
||||
|
||||
// =======================================================================================
|
||||
// Close plugin
|
||||
// ----------------
|
||||
void OpenGL_Shutdown()
|
||||
{
|
||||
#if USE_SDL
|
||||
SDL_Quit();
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
cocoaGLDelete(GLWin.cocoaCtx);
|
||||
#elif defined(USE_WX) && USE_WX
|
||||
#if defined(USE_WX) && USE_WX
|
||||
delete GLWin.glCanvas;
|
||||
delete GLWin.frame;
|
||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||
cocoaGLDelete(GLWin.cocoaCtx);
|
||||
|
||||
#elif defined(_WIN32)
|
||||
if (hRC) // Do We Have A Rendering Context?
|
||||
{
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include <GL/glew.h>
|
||||
#include "wx/wx.h"
|
||||
#include "wx/glcanvas.h"
|
||||
#undef HAVE_X11
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
#define I_NEED_OS2_H // HAXXOR
|
||||
#include <GL/glxew.h>
|
||||
|
|
|
@ -260,7 +260,9 @@ bool Renderer::Init()
|
|||
return false;
|
||||
|
||||
// Handle VSync on/off
|
||||
#ifdef _WIN32
|
||||
#if defined USE_WX && USE_WX
|
||||
// TODO: FILL IN
|
||||
#elif defined _WIN32
|
||||
if (WGLEW_EXT_swap_control)
|
||||
wglSwapIntervalEXT(g_Config.bVSync ? 1 : 0);
|
||||
else
|
||||
|
|
|
@ -109,10 +109,6 @@ if gfxenv['USE_WX'] and not gfxenv['HAVE_WX']:
|
|||
print "Must have wx to use wxgl"
|
||||
Return()
|
||||
|
||||
if gfxenv['USE_SDL'] and not gfxenv['HAVE_SDL']:
|
||||
print "Must have sdl to use SDL gl"
|
||||
Return()
|
||||
|
||||
gfxenv.Append(
|
||||
CXXFLAGS = compileFlags,
|
||||
LINKFLAGS = linkFlags,
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
#include "WXGLWindow.h"
|
||||
|
||||
void WXGLWindow::SwapBuffers() {
|
||||
glCanvas->SwapBuffers();
|
||||
}
|
||||
|
||||
void WXGLWindow::SetWindowText(const char *text) {
|
||||
frame->SetTitle(wxString::FromAscii(text));
|
||||
}
|
||||
|
||||
bool WXGLWindow::PeekMessages() {
|
||||
// TODO implmenent
|
||||
return false;
|
||||
}
|
||||
|
||||
void WXGLWindow::Update() {
|
||||
updateDim();
|
||||
}
|
||||
|
||||
bool WXGLWindow::MakeCurrent() {
|
||||
glCanvas->SetCurrent(*glCtxt);
|
||||
return true;
|
||||
}
|
||||
|
||||
WXGLWindow::~WXGLWindow() {
|
||||
delete glCanvas;
|
||||
delete frame;
|
||||
}
|
||||
|
||||
WXGLWindow::WXGLWindow() : GLWindow() {
|
||||
|
||||
updateDim();
|
||||
|
||||
int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0};
|
||||
|
||||
wxSize size(GetWidth(), GetHeight());
|
||||
if (!g_Config.renderToMainframe ||
|
||||
g_VideoInitialize.pWindowHandle == NULL) {
|
||||
frame = new wxFrame((wxWindow *)g_VideoInitialize.pWindowHandle,
|
||||
-1, _("Dolphin"), wxPoint(0,0), size);
|
||||
} else {
|
||||
frame = new wxFrame((wxWindow *)NULL,
|
||||
-1, _("Dolphin"), wxPoint(0,0), size);
|
||||
}
|
||||
glCanvas = new wxGLCanvas(frame, wxID_ANY, args,
|
||||
wxPoint(0,0), size, wxSUNKEN_BORDER);
|
||||
glCtxt = new wxGLContext(glCanvas);
|
||||
|
||||
frame->Show(TRUE);
|
||||
glCanvas->Show(TRUE);
|
||||
|
||||
glCanvas->SetCurrent(*glCtxt);
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#ifndef _WXGLWINDOW_H
|
||||
#define _WXGLWINDOW_H
|
||||
|
||||
#include "GLWindow.h"
|
||||
#if defined USE_WX && USE_WX
|
||||
#include "wx/wx.h"
|
||||
#include "wx/glcanvas.h"
|
||||
|
||||
class WXGLWindow : public GLWindow
|
||||
{
|
||||
private:
|
||||
wxGLCanvas *glCanvas;
|
||||
wxFrame *frame;
|
||||
wxGLContext *glCtxt;
|
||||
|
||||
public:
|
||||
|
||||
virtual void SwapBuffers();
|
||||
virtual void SetWindowText(const char *text);
|
||||
virtual bool PeekMessages();
|
||||
virtual void Update();
|
||||
virtual bool MakeCurrent();
|
||||
|
||||
static bool valid() { return true; }
|
||||
~WXGLWindow();
|
||||
WXGLWindow();
|
||||
|
||||
};
|
||||
#else
|
||||
class WXGLWindow : public GLWindow
|
||||
{
|
||||
public:
|
||||
WXGLWindow() {}
|
||||
};
|
||||
#endif
|
||||
#endif
|
Loading…
Reference in New Issue