Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qcocoaglcontext.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QCOCOAGLCONTEXT_H
5#define QCOCOAGLCONTEXT_H
6
7#include <QtCore/QPointer>
8#include <QtCore/QVarLengthArray>
9#include <QtCore/private/qcore_mac_p.h>
10#include <qpa/qplatformopenglcontext.h>
11#include <QtGui/qopenglcontext.h>
12#include <QtGui/private/qopenglcontext_p.h>
13#include <QtGui/QWindow>
14
16Q_FORWARD_DECLARE_OBJC_CLASS(NSOpenGLPixelFormat);
17
19
20class QCocoaWindow;
21
23{
24public:
26 QCocoaGLContext(NSOpenGLContext *context);
28
29 void initialize() override;
30
31 bool makeCurrent(QPlatformSurface *surface) override;
32 void swapBuffers(QPlatformSurface *surface) override;
33 void doneCurrent() override;
34
35 void update();
36
37 QSurfaceFormat format() const override;
38 bool isSharing() const override;
39 bool isValid() const override;
40
41 NSOpenGLContext *nativeContext() const override;
42
43 QFunctionPointer getProcAddress(const char *procName) override;
44
45private:
46 static NSOpenGLPixelFormat *pixelFormatForSurfaceFormat(const QSurfaceFormat &format);
47
48 bool setDrawable(QPlatformSurface *surface);
49 void updateSurfaceFormat();
50
51 NSOpenGLContext *m_context = nil;
52 NSOpenGLContext *m_shareContext = nil;
53 QSurfaceFormat m_format;
54 QVarLengthArray<QMacNotificationObserver, 3> m_updateObservers;
55 QAtomicInt m_needsUpdate = false;
56
57#ifndef QT_NO_DEBUG_STREAM
59#endif
60};
61
63
64#endif // QCOCOAGLCONTEXT_H
\inmodule QtCore
Definition qatomic.h:112
NSOpenGLContext * nativeContext() const override
void swapBuffers(QPlatformSurface *surface) override
Reimplement in subclass to native swap buffers calls.
void doneCurrent() override
friend QDebug operator<<(QDebug debug, const QCocoaGLContext *screen)
QSurfaceFormat format() const override
bool isSharing() const override
void initialize() override
Called after a new instance is constructed.
QCocoaGLContext(QOpenGLContext *context)
bool makeCurrent(QPlatformSurface *surface) override
bool isValid() const override
\inmodule QtCore
Native interface to an NSOpenGLContext on \macos.
\inmodule QtGui
The QPlatformOpenGLContext class provides an abstraction for native GL contexts.
QOpenGLContext * context() const
The QPlatformSurface class provides an abstraction for a surface.
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
Combined button and popup list for selecting options.
#define Q_FORWARD_DECLARE_OBJC_CLASS(classname)
GLint GLsizei GLsizei GLenum format
const void * getProcAddress
QScreen * screen
[1]
Definition main.cpp:29