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_2.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_2
22 \inmodule QtOpenGL
23 \since 5.1
24 \wrapper
25 \brief The QOpenGLFunctions_1_2 class provides all functions for OpenGL 1.2 specification.
26
27 This class is a wrapper for functions from OpenGL 1.2 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_2::QOpenGLFunctions_1_2()
35 : QAbstractOpenGLFunctions()
36 , d_1_0_Core(nullptr)
37 , d_1_1_Core(nullptr)
38 , d_1_2_Core(nullptr)
39 , d_1_0_Deprecated(nullptr)
40 , d_1_1_Deprecated(nullptr)
41 , d_1_2_Deprecated(nullptr)
42{
43}
44
45QOpenGLFunctions_1_2::~QOpenGLFunctions_1_2()
46{
47 if (d_1_0_Core) {
48 d_1_0_Core->refs.deref();
49 Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
50 }
51 if (d_1_1_Core) {
52 d_1_1_Core->refs.deref();
53 Q_ASSERT(d_1_1_Core->refs.loadRelaxed());
54 }
55 if (d_1_2_Core) {
56 d_1_2_Core->refs.deref();
57 Q_ASSERT(d_1_2_Core->refs.loadRelaxed());
58 }
59 if (d_1_0_Deprecated) {
60 d_1_0_Deprecated->refs.deref();
61 Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
62 }
63 if (d_1_1_Deprecated) {
64 d_1_1_Deprecated->refs.deref();
65 Q_ASSERT(d_1_1_Deprecated->refs.loadRelaxed());
66 }
67 if (d_1_2_Deprecated) {
68 d_1_2_Deprecated->refs.deref();
69 Q_ASSERT(d_1_2_Deprecated->refs.loadRelaxed());
70 }
71}
72
73bool QOpenGLFunctions_1_2::initializeOpenGLFunctions()
74{
75 if ( isInitialized() )
76 return true;
77
78 QOpenGLContext* context = QOpenGLContext::currentContext();
79
80 // If owned by a context object make sure it is current.
81 // Also check that current context is capable of resolving all needed functions
82 if (((owningContext() && owningContext() == context) || !owningContext())
83 && QOpenGLFunctions_1_2::isContextCompatible(context))
84 {
85 // Associate with private implementation, creating if necessary
86 // Function pointers in the backends are resolved at creation time
87 QOpenGLVersionFunctionsBackend* d = nullptr;
88 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
89 d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
90 d->refs.ref();
91
92 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_CoreBackend::versionStatus());
93 d_1_1_Core = static_cast<QOpenGLFunctions_1_1_CoreBackend*>(d);
94 d->refs.ref();
95
96 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_CoreBackend::versionStatus());
97 d_1_2_Core = static_cast<QOpenGLFunctions_1_2_CoreBackend*>(d);
98 d->refs.ref();
99
100 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
101 d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
102 d->refs.ref();
103
104 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_1_DeprecatedBackend::versionStatus());
105 d_1_1_Deprecated = static_cast<QOpenGLFunctions_1_1_DeprecatedBackend*>(d);
106 d->refs.ref();
107
108 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_2_DeprecatedBackend::versionStatus());
109 d_1_2_Deprecated = static_cast<QOpenGLFunctions_1_2_DeprecatedBackend*>(d);
110 d->refs.ref();
111
112 QAbstractOpenGLFunctions::initializeOpenGLFunctions();
113 }
114 return isInitialized();
115}
116
117bool QOpenGLFunctions_1_2::isContextCompatible(QOpenGLContext *context)
118{
119 Q_ASSERT(context);
120 QSurfaceFormat f = context->format();
121 const auto v = std::pair(f.majorVersion(), f.minorVersion());
122 if (v < std::pair(1, 2))
123 return false;
124
125 if (f.profile() == QSurfaceFormat::CoreProfile)
126 return false;
127
128 return true;
129}
130
131QOpenGLVersionProfile QOpenGLFunctions_1_2::versionProfile()
132{
133 QOpenGLVersionProfile v;
134 v.setVersion(1, 2);
135 return v;
136}
137
138QT_END_NAMESPACE
Combined button and popup list for selecting options.