summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authornakeee <nakeee@gmail.com>2008-12-10 23:23:05 +0000
committernakeee <nakeee@gmail.com>2008-12-10 23:23:05 +0000
commit32a7c530e6c8a7ff99a1593e8d89150765e2a3cd (patch)
tree1d8a9d6822ed20dda4c2a45860d54a3a7697750b /Source
parentc26c92cffd50c53db23898ac57aa1f55775b09fa (diff)
define mess and some other small fixes
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1493 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/Config.h1
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp45
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h46
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/NativeVertexFormat.cpp1
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/Render.cpp5
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/main.cpp8
6 files changed, 64 insertions, 42 deletions
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Config.h b/Source/Plugins/Plugin_VideoOGL/Src/Config.h
index d39e1e9907..1568634053 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Config.h
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Config.h
@@ -17,6 +17,7 @@
#ifndef _CONFIG_H
#define _CONFIG_H
+//#define USE_WX 1
// Log in two categories, andsave three other options in the same byte
#define CONF_LOG 1
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
index dd74804a26..7eb1c65dee 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
@@ -41,6 +41,7 @@ struct RECT
#include <SDL.h>
#endif
+
// Handles OpenGL and the window
// externals
@@ -63,11 +64,13 @@ void OpenGL_SwapBuffers()
{
#if USE_SDL
SDL_GL_SwapBuffers();
-#elif defined(OSX64)
+#elif defined(HAVE_COCOA) && HAVE_COCOA
cocoaGLSwap(GLWin.cocoaCtx,GLWin.cocoaWin);
#elif defined(_WIN32)
SwapBuffers(hDC);
-#else // GLX
+#elif defined(USE_WX) && USE_WX
+ GLWin.Wxcs->SwapBuffers();
+#elif defined(HAVE_X11) && HAVE_X11
glXSwapBuffers(GLWin.dpy, GLWin.win);
#endif
}
@@ -76,7 +79,7 @@ void OpenGL_SetWindowText(const char *text)
{
#if USE_SDL
SDL_WM_SetCaption(text, NULL);
-#elif defined(OSX64)
+#elif defined(HAVE_COCOA) && HAVE_COCOA
cocoaGLSetTitle();
#elif defined(_WIN32)
SetWindowText(EmuWindow::GetWnd(), text);
@@ -89,7 +92,7 @@ void OpenGL_SetWindowText(const char *text)
#endif
}
-unsigned int Callback_PeekMessages()
+unsigned int Callback_PeekMessages()
{
#ifdef _WIN32
//TODO: peekmessage
@@ -202,6 +205,17 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
GLWin.height = nBackbufferHeight;
GLWin.cocoaWin = cocoaGLCreateWindow(GLWin.width, GLWin.height);
GLWin.cocoaCtx = cocoaGLInit(g_Config.iMultisampleMode);
+#elif defined(USE_WX) && USE_WX
+ int attrib[2];
+ attrib[0] = WX_GL_DEPTH_SIZE;
+ attrib[1] = 32;
+ wxFrame *frame = new wxFrame((wxFrame *)NULL, -1, _("Test frame"), wxPoint(50,50), wxSize(400,400) );
+ GLWin.Wxcs = new wxGLCanvas(frame, -1, wxPoint(0,0), wxSize(400,400), wxSUNKEN_BORDER, _("some text"));
+
+ frame->Show(TRUE);
+
+ GLWin.Wxcs->SetCurrent();
+
#elif defined(_WIN32)
// create the window
if (!g_Config.renderToMainframe || g_VideoInitialize.pWindowHandle == NULL)
@@ -372,7 +386,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
GLWin.attr.colormap = cmap;
GLWin.attr.border_pixel = 0;
-#ifndef __APPLE__
+#if defined(HAVE_XXF86VM) && HAVE_XXF86VM
// get a connection
XF86VidModeQueryVersion(GLWin.dpy, &vidModeMajorVersion, &vidModeMinorVersion);
@@ -482,14 +496,14 @@ bool OpenGL_MakeCurrent()
SDL_Quit();
return false;
}
-#elif defined(OSX64)
+#elif defined(HAVE_COCOA) && HAVE_COCOA
cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
#elif defined(_WIN32)
if (!wglMakeCurrent(hDC,hRC)) {
MessageBox(NULL,"(5) Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return false;
}
-#else // GLX
+#elif defined(HAVE_X11) && HAVE_X11
Window winDummy;
unsigned int borderDummy;
// connect the glx-context to the window
@@ -520,11 +534,14 @@ void OpenGL_Update()
if (!surface) return;
nBackbufferWidth = surface->w;
nBackbufferHeight = surface->h;
-#elif defined(OSX64)
+#elif defined(HAVE_COCOA) && HAVE_COCOA
RECT rcWindow;
- rcWindow.right = GLWin.width;
- rcWindow.bottom = GLWin.height;
+ rcWindow.right = GLWin.width;
+ rcWindow.bottom = GLWin.height;
+#elif defined(USE_WX) && USE_WX
+ RECT rcWindow;
+ // TODO fill in
#elif defined(_WIN32)
RECT rcWindow;
if (!EmuWindow::GetParentWnd()) {
@@ -552,7 +569,7 @@ void OpenGL_Update()
nBackbufferWidth = width;
nBackbufferHeight = height;
-#else // GLX
+#elif defined(HAVE_X11) && HAVE_X11
// We just check all of our events here
XEvent event;
KeySym key;
@@ -669,8 +686,8 @@ void OpenGL_Shutdown()
{
#if USE_SDL
SDL_Quit();
-#elif defined(OSX64)
- cocoaGLDelete(GLWin.cocoaCtx);
+#elif defined(HAVE_COCOA) && HAVE_COCOA
+ cocoaGLDelete(GLWin.cocoaCtx);
#elif defined(_WIN32)
if (hRC) // Do We Have A Rendering Context?
{
@@ -706,7 +723,7 @@ void OpenGL_Shutdown()
XCloseDisplay(GLWin.dpy);
GLWin.ctx = NULL;
}
-#ifndef __APPLE__
+#if defined(HAVE_XXF86VM) && HAVE_XXF86VM
/* switch back to original desktop resolution if we were in fs */
if (GLWin.dpy != NULL) {
if (GLWin.fs) {
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h
index e662bd16aa..b822965b73 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h
+++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h
@@ -18,6 +18,7 @@
#ifndef _GLINIT_H
#define _GLINIT_H
+#include "Config.h"
#include "pluginspecs_video.h"
#ifdef _WIN32
@@ -32,25 +33,25 @@
#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"
+#include "wx/glcanvas.h"
+#undef HAVE_X11
+#elif defined(HAVE_X11) && HAVE_X11
#define I_NEED_OS2_H // HAXXOR
-//#include <GL/glew.h>
-#if defined(HAVE_X11) && HAVE_X11
#include <GL/glxew.h>
-#else
-#undef BOOL
+#elif defined(HAVE_COCOA) && HAVE_COCOA
#include <GL/glew.h>
#include "cocoaGL.h"
-#endif
+#endif // end USE_WX
#if defined(__APPLE__)
#include <OpenGL/gl.h>
-
#else
-
#include <GL/gl.h>
-
#endif
-//#include <GL/glx.h>
+
#define __inline inline
#include <sys/timeb.h> // ftime(), struct timeb
@@ -85,39 +86,40 @@ inline unsigned long timeGetTime()
#define GL_REPORT_ERRORD()
#endif
-#ifndef _WIN32
-
-#undef I_NEED_OS2_H
-#undef BOOL
+#ifndef _WIN32
#if defined(HAVE_X11) && HAVE_X11
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
-#ifndef __APPLE__
+#if defined(HAVE_XXF86VM) && HAVE_XXF86VM
#include <X11/extensions/xf86vmode.h>
-#endif
-//#include <gtk/gtk.h>
-#endif
+#endif // XXF86VM
+#endif // X11
+
#include <sys/stat.h>
#include <sys/types.h>
typedef struct {
int screen;
-#if defined(OSX64)
+#if defined(HAVE_COCOA) && HAVE_COCOA
NSWindow *cocoaWin;
NSOpenGLContext *cocoaCtx;
-#else //linux
+#elif defined(HAVE_X11) && HAVE_X11
Window win;
Display *dpy;
GLXContext ctx;
XSetWindowAttributes attr;
Bool fs;
Bool doubleBuffered;
-#ifndef __APPLE__
+#if defined(HAVE_XXF86VM) && HAVE_XXF86VM
XF86VidModeModeInfo deskMode;
-#endif
-#endif
+#endif // XXF86VM
+#endif // X11
+#if defined(USE_WX) && USE_WX
+ wxGLCanvas *Wxcs;
+
+#endif
int x, y;
unsigned int width, height;
unsigned int depth;
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/NativeVertexFormat.cpp b/Source/Plugins/Plugin_VideoOGL/Src/NativeVertexFormat.cpp
index ebe1ae70b6..6d68806ba0 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/NativeVertexFormat.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/NativeVertexFormat.cpp
@@ -15,6 +15,7 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
+#include "Config.h"
#include "GLUtil.h"
#include "Profiler.h"
#include "x64Emitter.h"
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
index f05f170754..932095d4af 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
@@ -142,8 +142,7 @@ bool Renderer::Create2()
wglSwapIntervalEXT(0);
else
ERROR_LOG("no support for SwapInterval (framerate clamped to monitor refresh rate)\n");
-#else
-#ifdef __linux__
+#elif defined(HAVE_X11) && HAVE_X11
if (glXSwapIntervalSGI)
glXSwapIntervalSGI(0);
else
@@ -153,7 +152,7 @@ bool Renderer::Create2()
//TODO
#endif
-#endif
+
// check the max texture width and height
glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&g_MaxTexWidth);
g_MaxTexHeight = g_MaxTexWidth;
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
index 2e7ea692b6..ce17d19ace 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
@@ -154,7 +154,8 @@ void DllConfig(HWND _hParent)
frame->ShowModal();
//win.SetHWND(0);
-#elif defined(HAVE_WX) && HAVE_WX
+#elif defined(HAVE_X11) && HAVE_X11
+#if defined(HAVE_XXF86VM) && HAVE_XXF86VM
ConfigDialog frame(NULL);
g_Config.Load();
int glxMajorVersion, glxMinorVersion;
@@ -188,6 +189,7 @@ void DllConfig(HWND _hParent)
}
XFree(modes);
frame.ShowModal();
+#endif
#else
//TODO
#endif
@@ -235,9 +237,9 @@ void Video_DoState(unsigned char **ptr, int mode) {
// PanicAlert("Can't Activate The GL Rendering Context for saving");
// return;
// }
-#elif defined(OSX64)
+#elif defined(HAVE_COCOA) && HAVE_COCOA
cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
-#else // Linux
+#elif defined(HAVE_X11) && HAVE_X11
glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
#endif