Some cleanup Should affect windows tell me if it does

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1592 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
nakeee 2008-12-19 11:46:52 +00:00
parent 2bb169ce37
commit db15121b5d
12 changed files with 190 additions and 22 deletions

View File

@ -97,6 +97,7 @@ vars.AddVariables(
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('gltext', 'temp don\'t use (WIP)', False),
EnumVariable('flavor', 'Choose a build flavor', 'release',
allowed_values = ('release', 'devel', 'debug', 'fastlog'),
ignorecase = 2
@ -232,6 +233,12 @@ if env['sdlgl']:
env['HAVE_COCOA'] = 0
env['USE_WX'] = 0
env['GLTEST'] = 0
if env['gltext']:
env['GLTEST'] = 1
conf.Define('GLTEST', env['GLTEST'])
# Gui less build
if env['nowx']:
env['HAVE_WX'] = 0;

View File

@ -58,6 +58,7 @@
#else
#define _stricmp strcasecmp
#define _unlink unlink
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
#endif
#ifdef _WIN32

View File

@ -47,4 +47,7 @@ class Timer
};
} // end of namespace Common
#ifdef __GNUC__
u32 timeGetTime();
#endif
#endif

View File

@ -18,6 +18,9 @@
#ifndef _GLINIT_H
#define _GLINIT_H
#if defined GLTEST && GLTEST
#include "nGLUtil.h"
#else
#include "Config.h"
#include "pluginspecs_video.h"
@ -32,7 +35,6 @@
#else // linux basic definitions
#define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
#if defined(USE_WX) && USE_WX
#include <GL/glew.h>
#include "wx/wx.h"
@ -55,23 +57,6 @@
#include <GL/gl.h>
#endif
#define __inline inline
#include <sys/timeb.h> // ftime(), struct timeb
inline unsigned long timeGetTime()
{
#ifdef _WIN32
_timeb t;
_ftime(&t);
#else
timeb t;
ftime(&t);
#endif
return (unsigned long)(t.time*1000+t.millitm);
}
#endif // linux basic definitions
#ifndef GL_DEPTH24_STENCIL8_EXT // allows FBOs to support stencils
@ -143,5 +128,5 @@ void OpenGL_SwapBuffers();
void OpenGL_SetWindowText(const char *text);
void OpenGL_Shutdown();
void OpenGL_Update();
#endif
#endif

View File

@ -35,6 +35,7 @@ class GLWindow {
u32 GetWidth() {return width;}
u32 GetHeight() {return height;}
virtual bool valid() { return false; }
// bool GLwindow(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight) {};
// setResolution
// resolution iter

View File

@ -42,6 +42,7 @@
#include "VertexLoaderManager.h"
#include "VertexLoader.h"
#include "XFB.h"
#include "Timer.h"
#if defined(HAVE_WX) && HAVE_WX
#include "Debugger/Debugger.h" // for the CDebugger class
#endif

View File

@ -12,8 +12,6 @@ name = "Plugin_VideoOGL"
files = [
'BPStructs.cpp',
'Globals.cpp',
'GLUtil.cpp',
'main.cpp',
'Config.cpp',
'memcpy_amd.cpp',
'OpcodeDecoding.cpp',
@ -45,6 +43,16 @@ libs = [
gfxenv = env.Clone()
if gfxenv['GLTEST']:
files += [
'nmain.cpp',
'nGLUtil.cpp',
]
else:
files += [
'main.cpp',
'GLUtil.cpp',
]
if gfxenv['HAVE_WX']:
files += [
'GUI/ConfigDlg.cpp',

View File

@ -2,6 +2,7 @@
#define _SDLWINDOW_H
#include "GLWindow.h"
#if defined HAVE_SDL && HAVE_SDL
#include <SDL.h>
class SDLWindow : public GLWindow
@ -21,4 +22,11 @@ public:
SDLWindow(int _iwidth, int _iheight);
};
#else
class SDLWindow : public GLWindow
{
public:
SDLWindow(int _iwidth, int _iheight) {}
};
#endif
#endif

View File

@ -2,6 +2,7 @@
#define _WXGLWINDOW_H
#include "GLWindow.h"
#if defined USE_WX && USE_WX
#include "wx/wx.h"
#include "wx/glcanvas.h"
@ -28,4 +29,10 @@ public:
WXGLWindow(int _iwidth, int _iheight);
};
#else
class WXGLWindow : public GLWindow
{
WXGLWindow(int _iwidth, int _iheight) {}
};
#endif
#endif

View File

@ -2,6 +2,7 @@
#define _X11WINDOW_H
#include "GLWindow.h"
#if defined HAVE_X11 && HAVE_X11
#include <GL/glxew.h>
#include <GL/gl.h>
@ -36,5 +37,11 @@ public:
~X11Window();
X11Window(int _iwidth, int _iheight);
};
#else
class X11Window : public GLWindow
{
public:
X11Window(int _iwidth, int _iheight) {}
};
#endif
#endif

View File

@ -0,0 +1,90 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Globals.h"
#include "IniFile.h"
#include "svnrev.h"
#include "Render.h"
#include "nGLUtil.h"
GLWindow *glWin = NULL;
void OpenGL_SwapBuffers()
{
glWin->SwapBuffers();
}
void OpenGL_SetWindowText(const char *text)
{
glWin->SetWindowText(text);
}
unsigned int Callback_PeekMessages()
{
return glWin->PeekMessages();
}
void UpdateFPSDisplay(const char *text)
{
char temp[512];
sprintf(temp, "SVN R%s: GL: %s", SVN_REV_STR, text);
OpenGL_SetWindowText(temp);
}
// =======================================================================================
// Create window. Called from main.cpp
bool OpenGL_Create(SVideoInitialize &_VideoInitialize,
int width, int height)
{
g_VideoInitialize.pPeekMessages = &Callback_PeekMessages;
g_VideoInitialize.pUpdateFPSDisplay = &UpdateFPSDisplay;
if (strncmp(iBackend, "sdl") == 0)
glWin = new SDLWindow(width, height);
else if (strncmp(iBackend, "x11") == 0)
glWin = new X11Window(width, height);
else if (strncmp(iBackend, "wxgl") == 0)
glWin = new WXGLWindow(width, height);
return (glWin?true:false);
}
bool OpenGL_MakeCurrent()
{
return glWin->MakeCurrent();
}
// =======================================================================================
// Update window width, size and etc. Called from Render.cpp
// ----------------
void OpenGL_Update()
{
glWin->Update();
}
// =======================================================================================
// Close plugin
// ----------------
void OpenGL_Shutdown()
{
glWin->Shutdown();
}

View File

@ -0,0 +1,50 @@
// Copyright (C) 2003-2008 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _NGLINIT_H
#define _NGLINIT_H
#include "Config.h"
#include "pluginspecs_video.h"
#include "GLWindow.h"
// backends
#include "SDLWindow.h"
#include "X11Window.h"
#include "WXGLWindow.h"
#ifndef GL_DEPTH24_STENCIL8_EXT // allows FBOs to support stencils
#define GL_DEPTH_STENCIL_EXT 0x84F9
#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
#define GL_DEPTH24_STENCIL8_EXT 0x88F0
#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
#endif
#define GL_REPORT_ERROR() { err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } }
#if defined(_DEBUG) || defined(DEBUGFAST)
#define GL_REPORT_ERRORD() { GLenum err = glGetError(); if( err != GL_NO_ERROR ) { ERROR_LOG("%s:%d: gl error 0x%x\n", __FILE__, (int)__LINE__, err); HandleGLError(); } }
#else
#define GL_REPORT_ERRORD()
#endif
// OLD interface todo remove
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
bool OpenGL_MakeCurrent();
void OpenGL_SwapBuffers();
void OpenGL_SetWindowText(const char *text);
void OpenGL_Shutdown();
void OpenGL_Update();
#endif