Search
lxdream.org :: lxdream/src/drivers/video_nsgl.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/video_nsgl.c
changeset 681:1755a126b109
prev665:99ae9dc4cab7
next736:a02d1475ccfd
author nkeynes
date Sun Jun 01 00:47:45 2008 +0000 (14 years ago)
permissions -rw-r--r--
last change First cut of the Cocoa GUI implementation
file annotate diff log raw
1.1 --- a/src/drivers/video_nsgl.c Sat Apr 19 00:36:36 2008 +0000
1.2 +++ b/src/drivers/video_nsgl.c Sun Jun 01 00:47:45 2008 +0000
1.3 @@ -21,13 +21,14 @@
1.4 #include "drivers/video_gl.h"
1.5 #include "pvr2/glutil.h"
1.6
1.7 -static NSOpenGLContext *nsgl_context;
1.8 +static NSOpenGLContext *nsgl_context = nil;
1.9
1.10 gboolean video_nsgl_init_driver( NSView *view, display_driver_t driver )
1.11 {
1.12 + NSAutoreleasePool *pool = [NSAutoreleasePool new];
1.13 NSOpenGLPixelFormatAttribute attributes[] = {
1.14 NSOpenGLPFAWindow,
1.15 - NSOpenGLPFADoubleBuffer,
1.16 +// NSOpenGLPFADoubleBuffer,
1.17 NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)24,
1.18 (NSOpenGLPixelFormatAttribute)nil };
1.19
1.20 @@ -37,7 +38,7 @@
1.21 [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: nil];
1.22 [nsgl_context setView: view];
1.23 [nsgl_context makeCurrentContext];
1.24 -
1.25 + [pool release];
1.26 if( gl_fbo_is_supported() ) {
1.27 gl_fbo_init(driver);
1.28 } else {
1.29 @@ -48,6 +49,27 @@
1.30 return TRUE;
1.31 }
1.32
1.33 +void video_nsgl_update()
1.34 +{
1.35 + if( nsgl_context != nil ) {
1.36 + [nsgl_context update];
1.37 + }
1.38 +}
1.39 +
1.40 +void video_nsgl_make_current()
1.41 +{
1.42 + if( nsgl_context != nil ) {
1.43 + [nsgl_context makeCurrentContext];
1.44 + }
1.45 +}
1.46 +
1.47 +void video_nsgl_swap_buffers()
1.48 +{
1.49 + if( nsgl_context != nil ) {
1.50 + [nsgl_context flushBuffer];
1.51 + }
1.52 +}
1.53 +
1.54 void video_nsgl_shutdown()
1.55 {
1.56 if( nsgl_context != nil ) {
.