diff options
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaglcontext.h')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaglcontext.h | 40 |
1 files changed, 33 insertions, 7 deletions
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 <QtCore/QWeakPointer> #include <QtGui/QPlatformGLContext> -#include <QtGui/QWindowFormat> +#include <QtGui/QGuiGLContext> +#include <QtGui/QWindow> #include <Cocoa/Cocoa.h> 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<QWindow> m_currentWindow; }; QT_END_NAMESPACE |