Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qopenglfunctions_1_1.cpp
Go to the documentation of this file.
1// Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3/***************************************************************************
4** This file was generated by glgen version 0.1
5** Command line was: glgen
6**
7** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
8**
9** This is an auto-generated file.
10** Do not edit! All changes made to it will be lost.
11**
12****************************************************************************/
13// Qt-Security score:significant reason:default
14
16#include "qopenglcontext.h"
17
19
20/*!
21 \class QOpenGLFunctions_1_1
22 \inmodule QtOpenGL
23 \since 5.1
24 \wrapper
25 \brief The QOpenGLFunctions_1_1 class provides all functions for OpenGL 1.1 specification.
26
27 This class is a wrapper for functions from OpenGL 1.1 specification.
28 See reference pages on \l {http://www.opengl.org/sdk/docs/}{opengl.org}
29 for function documentation.
30
31 \sa QAbstractOpenGLFunctions
32*/
33
34QOpenGLFunctions_1_1::QOpenGLFunctions_1_1()
35 : QAbstractOpenGLFunctions()
36 , d_1_0_Core(nullptr)
37 , d_1_1_Core(nullptr)
38 , d_1_0_Deprecated(nullptr)
39 , d_1_1_Deprecated(nullptr)
40{
41}
42
43QOpenGLFunctions_1_1::~QOpenGLFunctions_1_1()
44{
45 if (d_1_0_Core) {
46 d_1_0_Core->refs.deref();
47 Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
48 }
49 if (d_1_1_Core) {
50 d_1_1_Core->refs.deref();
51 Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
52 }
53 if (d_1_0_Deprecated) {
54 d_1_0_Deprecated->refs.deref();
55 Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
56 }
57 if (d_1_1_Deprecated) {
58 d_1_1_Deprecated->refs.deref();
59 Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
60 }
61}
62
63bool QOpenGLFunctions_1_1::initializeOpenGLFunctions()
64{
65 if ( isInitialized() )
66 return true;
67
68 QOpenGLContext* context = QOpenGLContext::currentContext();
69
70 // If owned by a context object make sure it is current.
71 // Also check that current context is capable of resolving all needed functions
72 if (((owningContext() && owningContext() == context) || !owningContext())
73 && QOpenGLFunctions_1_1::isContextCompatible(context))
74 {
75 // Associate with private implementation, creating if necessary
76 // Function pointers in the backends are resolved at creation time
77 QOpenGLVersionFunctionsBackend* d = nullptr;
78 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
79 d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
80 d->refs.ref();
81
82 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
83 d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
84 d->refs.ref();
85
86 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
87 d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
88 d->refs.ref();
89
90 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
91 d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
92 d->refs.ref();
93
94 QAbstractOpenGLFunctions::initializeOpenGLFunctions();
95 }
96 return isInitialized();
97}
98
99bool QOpenGLFunctions_1_1::isContextCompatible(QOpenGLContext *context)
100{
101 Q_ASSERT(context);
102 QSurfaceFormat f = context->format();
103 const auto v = std::pair(f.majorVersion(), f.minorVersion());
104 if (v < std::pair(1, 1))
105 return false;
106
107 if (f.profile() == QSurfaceFormat::CoreProfile)
108 return false;
109
110 return true;
111}
112
113QOpenGLVersionProfile QOpenGLFunctions_1_1::versionProfile()
114{
115 QOpenGLVersionProfile v;
116 v.setVersion(1, 1);
117 return v;
118}
119
120QT_END_NAMESPACE
Combined button and popup list for selecting options.