mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-14 00:09:24 +01:00
Update Video software plugin with latest cocoaGL.m file
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5076 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
377ece3294
commit
5e5e03daeb
@ -582,6 +582,7 @@ void OpenGL_Shutdown()
|
|||||||
delete GLWin.glCanvas;
|
delete GLWin.glCanvas;
|
||||||
delete GLWin.frame;
|
delete GLWin.frame;
|
||||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||||
|
cocoaGLDeleteWindow(GLWin.cocoaWin);
|
||||||
cocoaGLDelete(GLWin.cocoaCtx);
|
cocoaGLDelete(GLWin.cocoaCtx);
|
||||||
|
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
|
@ -19,6 +19,8 @@ NSOpenGLContext* cocoaGLInit(int mode);
|
|||||||
|
|
||||||
void cocoaGLDelete(NSOpenGLContext *ctx);
|
void cocoaGLDelete(NSOpenGLContext *ctx);
|
||||||
|
|
||||||
|
void cocoaGLDeleteWindow(NSWindow *window);
|
||||||
|
|
||||||
void cocoaGLSwap(NSOpenGLContext *ctx,NSWindow *window);
|
void cocoaGLSwap(NSOpenGLContext *ctx,NSWindow *window);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -4,11 +4,12 @@ NSWindow *cocoaGLCreateWindow(int w,int h)
|
|||||||
{
|
{
|
||||||
|
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
NSWindow *window;
|
NSWindow *window;
|
||||||
window = [[NSWindow alloc] initWithContentRect:NSMakeRect(50,50,w,h)
|
window = [[NSWindow alloc] initWithContentRect:NSMakeRect(50,50,w,h)
|
||||||
styleMask:NSTitledWindowMask | NSResizableWindowMask
|
styleMask:NSTitledWindowMask | NSResizableWindowMask
|
||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:FALSE];
|
defer:FALSE];
|
||||||
|
[window setReleasedWhenClosed: YES];
|
||||||
|
|
||||||
[window setTitle:@"Dolphin on OSX"];
|
[window setTitle:@"Dolphin on OSX"];
|
||||||
//[window makeKeyAndOrderFront: nil];
|
//[window makeKeyAndOrderFront: nil];
|
||||||
@ -29,24 +30,22 @@ void cocoaGLSetTitle(NSWindow *win, const char *title)
|
|||||||
|
|
||||||
void cocoaGLMakeCurrent(NSOpenGLContext *ctx, NSWindow *win)
|
void cocoaGLMakeCurrent(NSOpenGLContext *ctx, NSWindow *win)
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
int value = 0;
|
int value = 0;
|
||||||
[ctx setValues:&value forParameter:NSOpenGLCPSwapInterval];
|
[ctx setValues:&value forParameter:NSOpenGLCPSwapInterval];
|
||||||
|
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
|
[ctx setView:[win contentView]];
|
||||||
[ctx setView:[win contentView]];
|
[ctx update];
|
||||||
[ctx update];
|
[ctx makeCurrentContext];
|
||||||
[ctx makeCurrentContext];
|
}
|
||||||
} else {
|
else
|
||||||
[NSOpenGLContext clearCurrentContext];
|
[NSOpenGLContext clearCurrentContext];
|
||||||
}
|
|
||||||
|
|
||||||
[pool release];
|
|
||||||
|
|
||||||
|
[pool release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -54,10 +53,11 @@ void cocoaGLMakeCurrent(NSOpenGLContext *ctx, NSWindow *win)
|
|||||||
NSOpenGLContext* cocoaGLInit(int mode)
|
NSOpenGLContext* cocoaGLInit(int mode)
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
NSOpenGLPixelFormatAttribute attr[32];
|
|
||||||
NSOpenGLPixelFormat *fmt;
|
NSOpenGLPixelFormatAttribute attr[32];
|
||||||
NSOpenGLContext *context;
|
NSOpenGLPixelFormat *fmt;
|
||||||
int i = 0;
|
NSOpenGLContext *context;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
@ -65,10 +65,11 @@ NSOpenGLContext* cocoaGLInit(int mode)
|
|||||||
attr[i++] = 24;
|
attr[i++] = 24;
|
||||||
attr[i++] = NSOpenGLPFADoubleBuffer;
|
attr[i++] = NSOpenGLPFADoubleBuffer;
|
||||||
|
|
||||||
attr[i++] = NSOpenGLPFASampleBuffers;
|
attr[i++] = NSOpenGLPFASampleBuffers;
|
||||||
attr[i++] = mode;
|
attr[i++] = mode;
|
||||||
attr[i++] = NSOpenGLPFASamples;
|
attr[i++] = NSOpenGLPFASamples;
|
||||||
attr[i++] = 1;
|
attr[i++] = 1;
|
||||||
|
|
||||||
attr[i++] = NSOpenGLPFANoRecovery;
|
attr[i++] = NSOpenGLPFANoRecovery;
|
||||||
#ifdef GL_VERSION_1_3
|
#ifdef GL_VERSION_1_3
|
||||||
|
|
||||||
@ -80,62 +81,69 @@ NSOpenGLContext* cocoaGLInit(int mode)
|
|||||||
attr[i++] = kCGLRendererGenericFloatID;
|
attr[i++] = kCGLRendererGenericFloatID;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
attr[i++] = NSOpenGLPFAScreenMask;
|
attr[i++] = NSOpenGLPFAScreenMask;
|
||||||
attr[i++] = CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID());
|
attr[i++] = CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID());
|
||||||
|
|
||||||
attr[i] = 0;
|
attr[i] = 0;
|
||||||
|
|
||||||
fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
|
fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attr];
|
||||||
if (fmt == nil) {
|
if (fmt == nil) {
|
||||||
printf("failed to create pixel format\n");
|
printf("failed to create pixel format\n");
|
||||||
[pool release];
|
[pool release];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:nil];
|
context = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:nil];
|
||||||
|
|
||||||
[fmt release];
|
[fmt release];
|
||||||
|
|
||||||
if (context == nil) {
|
if (context == nil) {
|
||||||
printf("failed to create context\n");
|
printf("failed to create context\n");
|
||||||
[pool release];
|
[pool release];
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cocoaGLDelete(NSOpenGLContext *ctx)
|
void cocoaGLDelete(NSOpenGLContext *ctx)
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
[ctx clearDrawable];
|
[ctx clearDrawable];
|
||||||
[ctx release];
|
[ctx release];
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
void cocoaGLDeleteWindow(NSWindow *window)
|
||||||
|
{
|
||||||
|
|
||||||
|
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
|
||||||
|
[window close];
|
||||||
|
[pool release];
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
void cocoaGLSwap(NSOpenGLContext *ctx,NSWindow *window)
|
void cocoaGLSwap(NSOpenGLContext *ctx,NSWindow *window)
|
||||||
{
|
{
|
||||||
NSAutoreleasePool *pool;
|
NSAutoreleasePool *pool;
|
||||||
|
|
||||||
pool = [[NSAutoreleasePool alloc] init];
|
pool = [[NSAutoreleasePool alloc] init];
|
||||||
[window makeKeyAndOrderFront: nil];
|
[window makeKeyAndOrderFront: nil];
|
||||||
|
|
||||||
ctx = [NSOpenGLContext currentContext];
|
ctx = [NSOpenGLContext currentContext];
|
||||||
if (ctx != nil) {
|
if (ctx != nil)
|
||||||
[ctx flushBuffer];
|
[ctx flushBuffer];
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
printf("bad cocoa gl ctx\n");
|
printf("bad cocoa gl ctx\n");
|
||||||
}
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user