[329/906] Build for Cocoa on darwin, with various fixes

This commit is contained in:
David Schleef 2009-04-12 22:24:06 -07:00 committed by Matthew Waters
parent d164f882be
commit b47fc234ef
3 changed files with 28 additions and 10 deletions

View file

@ -3,15 +3,25 @@ lib_LTLIBRARIES = libgstgl-@GST_MAJORMINOR@.la
EXTRA_DIST = \
gstglwindow_x11.c \
gstglwindow_win32.c
gstglwindow_win32.c \
gstglwindow_cocoa.m
libgstgl_@GST_MAJORMINOR@_la_SOURCES = \
gstglwindow_@GL_BACKEND@.c \
gstgldisplay.c \
gstglbuffer.c \
gstglfilter.c \
gstglshader.c
if GL_BACKEND_WIN32
libgstgl_@GST_MAJORMINOR@_la_SOURCES += gstglwindow_win32.c
endif
if GL_BACKEND_COCOA
libgstgl_@GST_MAJORMINOR@_la_SOURCES += gstglwindow_cocoa.m
endif
if GL_BACKEND_X11
libgstgl_@GST_MAJORMINOR@_la_SOURCES += gstglwindow_x11.c
endif
libgstgl_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/gl
libgstgl_@GST_MAJORMINOR@include_HEADERS = \
gstglwindow.h \
@ -28,6 +38,9 @@ libgstgl_@GST_MAJORMINOR@_la_LIBADD = \
libgstgl_@GST_MAJORMINOR@_la_CFLAGS = \
$(GL_CFLAGS) $(X_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstgl_@GST_MAJORMINOR@_la_OBJCFLAGS = \
$(GL_CFLAGS) $(X_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstgl_@GST_MAJORMINOR@_la_LDFLAGS = \
$(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)

View file

@ -30,8 +30,8 @@
#include "gstgles2.h"
/* OpenGL for usual systems */
#else
#if (!GNUSTEP && MACOS)
#include <OpenGL/glew.h>
#if __APPLE__
#include <GL/glew.h>
#include <OpenGL/OpenGL.h>
#include <OpenGL/gl.h>
#else

View file

@ -74,8 +74,8 @@
/* ============================================================= */
#ifndef GNUSTEP
static BOOL GSRegisterCurrentThread() { return TRUE; };
static GSUnregisterCurrentThread() {};
static BOOL GSRegisterCurrentThread(void) { return TRUE; };
static void GSUnregisterCurrentThread(void) {};
#endif
#define GST_GL_WINDOW_GET_PRIVATE(o) \
@ -185,11 +185,12 @@ gst_gl_window_new (gint width, gint height)
backing: NSBackingStoreBuffered defer: NO screen: nil gstWin: priv];
if (priv->internal_win_id) {
NSRect windowRect;
NSRect mainRect = [[NSScreen mainScreen] visibleFrame];
GST_DEBUG ("main screen rect: %d %d %d %d", (int) mainRect.origin.x, (int) mainRect.origin.y,
(int) mainRect.size.width, (int) mainRect.size.height);
NSRect windowRect = [priv->internal_win_id frame];
windowRect = [priv->internal_win_id frame];
GST_DEBUG ("window rect: %d %d %d %d", (int) windowRect.origin.x, (int) windowRect.origin.y,
(int) windowRect.size.width, (int) windowRect.size.height);
@ -370,8 +371,6 @@ gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback,
defer: (BOOL) flag screen: (NSScreen *) aScreen
gstWin: (GstGLWindowPrivate *) priv {
m_isClosed = NO;
m_priv = priv;
NSOpenGLView *glView = nil;
NSOpenGLPixelFormat *fmt = nil;
NSOpenGLContext *glContext = nil;
@ -386,6 +385,9 @@ gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback,
0
};
m_isClosed = NO;
m_priv = priv;
self = [super initWithContentRect: contentRect
styleMask: styleMask backing: bufferingType
defer: flag screen:aScreen];
@ -420,10 +422,13 @@ gst_gl_window_send_message (GstGLWindow * window, GstGLWindowCB callback,
* Discarded if you configured your driver to Never-use-V-Sync.
*/
NS_DURING {
#if 0
/* FIXME doesn't compile */
if (glContext) {
long swapInterval = 1;
[[glView openGLContext] setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
}
#endif
} NS_HANDLER {
g_debug ("your back-end does not implement NSOpenglContext::setValues");
}