From 864815ef2efbc3b5dca2a645c1b63f9bb67285d0 Mon Sep 17 00:00:00 2001 From: Morten Sorvig Date: Wed, 18 May 2011 12:09:17 +0200 Subject: Port Qt 5 to Mac. --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/plugins/platforms/cocoa/qcocoaglcontext.h (limited to 'src/plugins/platforms/cocoa/qcocoaglcontext.h') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h new file mode 100644 index 0000000000..b9a84a1606 --- /dev/null +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -0,0 +1,27 @@ +#ifndef QCOCOAGLCONTEXT_H +#define QCOCOAGLCONTEXT_H + +#include +#include + +#include + +QT_BEGIN_NAMESPACE + +class QCocoaGLContext : public QPlatformGLContext +{ +public: + QCocoaGLContext(NSOpenGLView *glView); + void makeCurrent(); + void doneCurrent(); + void swapBuffers(); + void* getProcAddress(const QString& procName); + QWindowFormat windowFormat() const; + static NSOpenGLPixelFormat *createNSOpenGLPixelFormat(); +private: + NSOpenGLView *m_glView; +}; + +QT_END_NAMESPACE + +#endif // QCOCOAGLCONTEXT_H -- cgit v1.2.3 From e285501267bc28c226e8f3a455f28b5090e934aa Mon Sep 17 00:00:00 2001 From: Morten Sorvig Date: Fri, 20 May 2011 10:47:59 +0200 Subject: Add QCocoaNativeInterface. Supports getting the NSOpenGLContext for now. --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins/platforms/cocoa/qcocoaglcontext.h') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index b9a84a1606..4d330a4294 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -18,6 +18,7 @@ public: void* getProcAddress(const QString& procName); QWindowFormat windowFormat() const; static NSOpenGLPixelFormat *createNSOpenGLPixelFormat(); + NSOpenGLContext *nsOpenGLContext() const; private: NSOpenGLView *m_glView; }; -- cgit v1.2.3 From 4a189c188ccd2fb5f8d1d5ddadf06cbd6bc0916f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 7 Jun 2011 17:25:22 +0200 Subject: QWindowContext / QWindowFormat refactor. To enable having a single GL context used for multiple drawables we need to de-couple the context class a bit more from the window class in the plugin API. Now contexts are created stand-alone based on a GL format and a share context, and when calling makeCurrent() a desired surface is specified. This maps well to GLX, EGL, Cocoa, AGL, and WGL, which all support this use case. QWindowContext is renamed to QGuiGLContext, and QWindowFormat is renamed to QGuiGLFormat. We have the ability to introduce a pbuffer or similar other offscreen GL drawable abstraction in the future. --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 40 ++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'src/plugins/platforms/cocoa/qcocoaglcontext.h') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index 4d330a4294..01d931b662 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -1,26 +1,52 @@ #ifndef QCOCOAGLCONTEXT_H #define QCOCOAGLCONTEXT_H +#include #include -#include +#include +#include #include QT_BEGIN_NAMESPACE +class QCocoaGLSurface : public QPlatformGLSurface +{ +public: + QCocoaGLSurface(const QGuiGLFormat &format, QWindow *window) + : QPlatformGLSurface(format) + , window(window) + { + } + + QWindow *window; +}; + class QCocoaGLContext : public QPlatformGLContext { public: - QCocoaGLContext(NSOpenGLView *glView); - void makeCurrent(); + QCocoaGLContext(const QGuiGLFormat &format, QPlatformGLContext *share); + + QGuiGLFormat format() const; + + void swapBuffers(const QPlatformGLSurface &surface); + + bool makeCurrent(const QPlatformGLSurface &surface); void doneCurrent(); - void swapBuffers(); - void* getProcAddress(const QString& procName); - QWindowFormat windowFormat() const; + + void (*getProcAddress(const QByteArray &procName)) (); + + void update(); + static NSOpenGLPixelFormat *createNSOpenGLPixelFormat(); NSOpenGLContext *nsOpenGLContext() const; + private: - NSOpenGLView *m_glView; + void setActiveWindow(QWindow *window); + + NSOpenGLContext *m_context; + QGuiGLFormat m_format; + QWeakPointer m_currentWindow; }; QT_END_NAMESPACE -- cgit v1.2.3 From 176f30b13739b352cbe453cba7796d9a9c808bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 21 Jun 2011 13:39:26 +0200 Subject: OpenGL API refactor. Rename QGuiGLFormat to QSurfaceFormat, and make QWindow sub-class of QSurface and QPlatformWindow sub-class of QPlatformSurface, instead of having QPlatformGLSurface accessor in QWindow. --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'src/plugins/platforms/cocoa/qcocoaglcontext.h') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index 01d931b662..9af931bf6c 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -10,28 +10,16 @@ QT_BEGIN_NAMESPACE -class QCocoaGLSurface : public QPlatformGLSurface -{ -public: - QCocoaGLSurface(const QGuiGLFormat &format, QWindow *window) - : QPlatformGLSurface(format) - , window(window) - { - } - - QWindow *window; -}; - class QCocoaGLContext : public QPlatformGLContext { public: - QCocoaGLContext(const QGuiGLFormat &format, QPlatformGLContext *share); + QCocoaGLContext(const QSurfaceFormat &format, QPlatformGLContext *share); - QGuiGLFormat format() const; + QSurfaceFormat format() const; - void swapBuffers(const QPlatformGLSurface &surface); + void swapBuffers(QPlatformSurface *surface); - bool makeCurrent(const QPlatformGLSurface &surface); + bool makeCurrent(QPlatformSurface *surface); void doneCurrent(); void (*getProcAddress(const QByteArray &procName)) (); @@ -45,7 +33,7 @@ private: void setActiveWindow(QWindow *window); NSOpenGLContext *m_context; - QGuiGLFormat m_format; + QSurfaceFormat m_format; QWeakPointer m_currentWindow; }; -- cgit v1.2.3 From 7d07ca24882ec49045c33d3cc67457bba6f5f73d Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 28 Jul 2011 10:15:18 +0200 Subject: Undefine "slots" before including cocoa headers to make it compile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Id2ba9d657a93e0d10b70b31b6a44a6ea9f598d8f Reviewed-on: http://codereview.qt.nokia.com/2328 Reviewed-by: Qt Sanity Bot Reviewed-by: Samuel Rødal --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins/platforms/cocoa/qcocoaglcontext.h') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index 9af931bf6c..786db322c1 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -6,6 +6,7 @@ #include #include +#undef slots #include QT_BEGIN_NAMESPACE -- cgit v1.2.3 From 6e28e8441b698c3397c2c78125c877f2e9867cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 22 Aug 2011 10:49:28 +0200 Subject: Copy core GL functionality to QtGui with QGL -> QOpenGL naming. Change-Id: Ibc989afa4a30dd184d41d1a1cd89f97196e48855 Reviewed-on: http://codereview.qt.nokia.com/3710 Reviewed-by: Gunnar Sletta --- src/plugins/platforms/cocoa/qcocoaglcontext.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/plugins/platforms/cocoa/qcocoaglcontext.h') diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.h b/src/plugins/platforms/cocoa/qcocoaglcontext.h index 786db322c1..1b84e7b305 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.h +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.h @@ -2,8 +2,8 @@ #define QCOCOAGLCONTEXT_H #include -#include -#include +#include +#include #include #undef slots @@ -11,10 +11,10 @@ QT_BEGIN_NAMESPACE -class QCocoaGLContext : public QPlatformGLContext +class QCocoaGLContext : public QPlatformOpenGLContext { public: - QCocoaGLContext(const QSurfaceFormat &format, QPlatformGLContext *share); + QCocoaGLContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share); QSurfaceFormat format() const; -- cgit v1.2.3