add cocoa in ogl plugin

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@976 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
tmator 2008-10-27 20:29:32 +00:00
parent 62b49ea2d6
commit a7be7689c1
5 changed files with 43 additions and 16 deletions

View File

@ -64,7 +64,7 @@ void OpenGL_SwapBuffers()
#if USE_SDL
SDL_GL_SwapBuffers();
#elif defined(OSX64)
cocoaGLSwap(GLWin.cocoaWin,GLWin.cocoaWin);
#elif defined(_WIN32)
SwapBuffers(hDC);
#else // GLX
@ -77,7 +77,7 @@ void OpenGL_SetWindowText(const char *text)
#if USE_SDL
SDL_WM_SetCaption(text, NULL);
#elif defined(OSX64)
cocoaGLSetTitle();
#elif defined(_WIN32)
SetWindowText(EmuWindow::GetWnd(), text);
#else // GLX
@ -101,6 +101,7 @@ BOOL Callback_PeekMessages()
// proper value to return.
return FALSE;
#elif defined(OSX64)
//TODO
return FALSE;
#elif defined(_WIN32)
//TODO: peekmessage
@ -210,7 +211,11 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
//setup ogl to use double buffering
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
#elif defined(OSX64)
cocoaGLCreateApp();
GLWin.width = nBackbufferWidth;
GLWin.height = nBackbufferHeight;
GLWin.cocoaWin = cocoaGLCreateWindow(GLWin.width, GLWin.height);
GLWin.cocoaCtx = cocoaGLInit(g_Config.iMultisampleMode);
#elif defined(_WIN32)
// create the window
if (!g_Config.renderToMainframe || g_VideoInitialize.pWindowHandle == NULL)
@ -491,7 +496,7 @@ bool OpenGL_MakeCurrent()
return false;
}
#elif defined(OSX64)
cocoaGLMakeCurrent(GLWin.cocoaWin,GLWin.cocoaCtx);
#elif defined(_WIN32)
if (!wglMakeCurrent(hDC,hRC)) {
MessageBox(NULL,"(5) Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
@ -530,6 +535,8 @@ void OpenGL_Update()
nBackbufferHeight = surface->h;
#elif defined(OSX64)
RECT rcWindow;
rcWindow.right = GLWin.width;
rcWindow.bottom = GLWin.height;
#elif defined(_WIN32)
if (!EmuWindow::GetParentWnd()) return;
@ -666,7 +673,7 @@ void OpenGL_Shutdown()
#if USE_SDL
SDL_Quit();
#elif defined(OSX64)
cocoaGLDelete(GLWin.cocoaCtx);
#elif defined(_WIN32)
if (hRC) // Do We Have A Rendering Context?
{

View File

@ -37,10 +37,12 @@
#if !defined(OSX64)
#include <GL/glxew.h>
#else
#undef BOOL
#include <GL/glew.h>
#include "cocoaGL.h"
#endif
#if defined(__APPLE__)
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#else
@ -88,21 +90,24 @@ inline unsigned long timeGetTime()
#undef I_NEED_OS2_H
#undef BOOL
#if !defined(__APPLE__)
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/extensions/xf86vmode.h>
//#include <gtk/gtk.h>
#endif
#include <sys/stat.h>
#include <sys/types.h>
typedef struct {
Display *dpy;
int screen;
Window win;
#if defined(OSX64)
NSWindow *cocoaWin;
NSOpenGLContext *cocoaCtx;
#else //linux
Window win;
Display *dpy;
GLXContext ctx;
XSetWindowAttributes attr;
Bool fs;

View File

@ -63,7 +63,10 @@ if gfxenv['osx64']:
if sys.platform == 'darwin':
platform = 'mac'
# SDL is currently the only way to get video on Mac OS X.
useSDL = True
if gfxenv['osx64']:
useSDL = False
else:
useSDL = True
# TODO: clean it up (use incpath and libpath)
# Use libraries from MacPorts.
compileFlags.append('-I/opt/local/include')

View File

@ -13,9 +13,17 @@ files = [
]
padenv = env.Clone()
padenv.Append(
CXXFLAGS = [ '-fPIC' ],
LIBS = [ 'common' ],
)
if not env['osx64']:
padenv.SharedLibrary(output, files)
if padenv['osx64']:
padenv.Append(
CXXFLAGS = [ '-arch', 'x86_64' ],
LINKFLAGS = [ '-arch', 'x86_64' ],
LIBS = [ 'common' ],
)
else:
padenv.Append(
CXXFLAGS = [ '-fPIC' ],
LIBS = [ 'common' ],
)
padenv.SharedLibrary(output, files)

View File

@ -1,4 +1,6 @@
#if !defined(OSX64)
#include <wx/aboutdlg.h>
#endif
#include "Common.h"
#include "StringUtil.h"
@ -145,11 +147,13 @@ extern "C" void GetDllInfo (PLUGIN_INFO* _PluginInfo)
extern "C" void DllAbout(HWND _hParent)
{
#if !defined(OSX64)
wxAboutDialogInfo info;
info.SetName(_T("Wiimote test plugin"));
info.AddDeveloper(_T("masken (masken3@gmail.com)"));
info.SetDescription(_T("Wiimote test plugin"));
wxAboutBox(info);
#endif
}
extern "C" void DllConfig(HWND _hParent)