revision 663:553bb7d6befa
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 663:553bb7d6befa |
parent | 662:7c8b88493ee1 |
child | 664:728508bb08df |
author | nkeynes |
date | Thu Apr 17 08:15:19 2008 +0000 (15 years ago) |
Commit NSGL work-in-progress
1.1 --- a/src/drivers/audio_pulse.c Thu Apr 17 07:54:17 2008 +00001.2 +++ b/src/drivers/audio_pulse.c Thu Apr 17 08:15:19 2008 +00001.3 @@ -1,5 +1,5 @@1.4 /**1.5 - * $Id: audio_pulse.c 661 2008-02-26 01:10:48Z bhaal22 $1.6 + * $Id$1.7 *1.8 * The pulseaudio sound driver1.9 *
2.1 --- a/src/drivers/video_gtk.c Thu Apr 17 07:54:17 2008 +00002.2 +++ b/src/drivers/video_gtk.c Thu Apr 17 08:15:19 2008 +00002.3 @@ -99,6 +99,21 @@2.5 #endif2.7 +#ifdef HAVE_GTK_OSX2.8 +#include "drivers/video_nsgl.h"2.9 +2.10 +// Include this prototype as some systems don't have gdkquartz.h installed2.11 +NSView *gdk_quartz_window_get_nsview( GdkWindow *window);2.12 +2.13 +guint gdk_keycode_to_modifier( GdkDisplay *display, guint keycode )2.14 +{2.15 + return 0;2.16 +}2.17 +2.18 +#endif2.19 +2.20 +2.21 +2.22 GtkWidget *gtk_video_drawable = NULL;2.23 int video_width = 640;2.24 int video_height = 480;2.25 @@ -271,6 +286,13 @@2.26 ! video_glx_init_driver( &display_gtk_driver ) ) {2.27 return FALSE;2.28 }2.29 +#else2.30 +#ifdef HAVE_NSGL2.31 + NSView *view = gdk_quartz_window_get_nsview(gtk_video_drawable->window);2.32 + if( ! video_nsgl_init_driver( view, &display_gtk_driver ) ) {2.33 + return FALSE;2.34 + }2.35 +#endif2.36 #endif2.37 #endif2.39 @@ -301,6 +323,10 @@2.40 #else2.41 #ifdef HAVE_GLX2.42 video_glx_shutdown();2.43 +#else2.44 +#ifdef HAVE_NSGL2.45 + video_nsgl_shutdown();2.46 +#endif2.47 #endif2.48 #endif2.49 }
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00003.2 +++ b/src/drivers/video_nsgl.c Thu Apr 17 08:15:19 2008 +00003.3 @@ -0,0 +1,63 @@3.4 +/**3.5 + * $Id$3.6 + *3.7 + * Cocoa (NSOpenGL) video driver3.8 + *3.9 + * Copyright (c) 2005 Nathan Keynes.3.10 + *3.11 + * This program is free software; you can redistribute it and/or modify3.12 + * it under the terms of the GNU General Public License as published by3.13 + * the Free Software Foundation; either version 2 of the License, or3.14 + * (at your option) any later version.3.15 + *3.16 + * This program is distributed in the hope that it will be useful,3.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of3.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3.19 + * GNU General Public License for more details.3.20 + */3.21 +3.22 +#include <AppKit/NSOpenGL.h>3.23 +#include "drivers/video_nsgl.h"3.24 +#include "drivers/video_gl.h"3.25 +#include "pvr2/glutil.h"3.26 +3.27 +static NSOpenGLContext *nsgl_context;3.28 +3.29 +gboolean video_nsgl_init_driver( NSView *view, display_driver_t driver )3.30 +{3.31 + NSOpenGLPixelFormatAttribute attributes[] = {3.32 + NSOpenGLPFAWindow,3.33 + NSOpenGLPFADoubleBuffer,3.34 + NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)24,3.35 + (NSOpenGLPixelFormatAttribute)nil };3.36 +3.37 + NSOpenGLPixelFormat *pixelFormat =3.38 + [[[NSOpenGLPixelFormat alloc] initWithAttributes: attributes] autorelease];3.39 + nsgl_context =3.40 + [[NSOpenGLContext alloc] initWithFormat: pixelFormat shareContext: nil];3.41 + [nsgl_context setView: view];3.42 + [nsgl_context makeCurrentContext];3.43 +3.44 + if( gl_fbo_is_supported() ) {3.45 + gl_fbo_init(driver);3.46 + } else {3.47 + ERROR( "FBO not supported" );3.48 + return FALSE;3.49 + }3.50 +3.51 + if( glsl_is_supported() ) {3.52 + if( !glsl_load_shaders( glsl_vertex_shader_src, NULL ) ) {3.53 + WARN( "Unable to load GL shaders" );3.54 + }3.55 + }3.56 + return TRUE;3.57 +}3.58 +3.59 +void video_nsgl_shutdown()3.60 +{3.61 + if( nsgl_context != nil ) {3.62 + [NSOpenGLContext clearCurrentContext];3.63 + [nsgl_context release];3.64 + nsgl_context = nil;3.65 + }3.66 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00004.2 +++ b/src/drivers/video_nsgl.h Thu Apr 17 08:15:19 2008 +00004.3 @@ -0,0 +1,37 @@4.4 +/**4.5 + * $Id$4.6 + *4.7 + * Cocoa (NSOpenGL) video driver4.8 + *4.9 + * Copyright (c) 2005 Nathan Keynes.4.10 + *4.11 + * This program is free software; you can redistribute it and/or modify4.12 + * it under the terms of the GNU General Public License as published by4.13 + * the Free Software Foundation; either version 2 of the License, or4.14 + * (at your option) any later version.4.15 + *4.16 + * This program is distributed in the hope that it will be useful,4.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of4.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4.19 + * GNU General Public License for more details.4.20 + */4.21 +4.22 +#ifndef video_nsgl_H4.23 +#define video_nsgl_H4.24 +4.25 +#include <AppKit/NSView.h>4.26 +#include "display.h"4.27 +4.28 +/**4.29 + * Initialize the display driver by setting the appropriate methods4.30 + * for NSGL support4.31 + */4.32 +gboolean video_nsgl_init_driver( NSView *view, display_driver_t driver );4.33 +4.34 +/**4.35 + * Shutdown GLX support and release all resources.4.36 + */4.37 +void video_nsgl_shutdown();4.38 +4.39 +4.40 +#endif /* !video_nsgl_H */4.41 \ No newline at end of file
.