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_0.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_0
22 \inmodule QtOpenGL
23 \since 5.1
24 \wrapper
25 \brief The QOpenGLFunctions_1_0 class provides all functions for OpenGL 1.0 specification.
26
27 This class is a wrapper for functions from OpenGL 1.0 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_0::QOpenGLFunctions_1_0()
35 : QAbstractOpenGLFunctions()
36 , d_1_0_Core(nullptr)
37 , d_1_0_Deprecated(nullptr)
38{
39}
40
41QOpenGLFunctions_1_0::~QOpenGLFunctions_1_0()
42{
43 if (d_1_0_Core) {
44 d_1_0_Core->refs.deref();
45 Q_ASSERT(d_1_0_Core->refs.loadRelaxed());
46 }
47 if (d_1_0_Deprecated) {
48 d_1_0_Deprecated->refs.deref();
49 Q_ASSERT(d_1_0_Deprecated->refs.loadRelaxed());
50 }
51}
52
53bool QOpenGLFunctions_1_0::initializeOpenGLFunctions()
54{
55 if ( isInitialized() )
56 return true;
57
58 QOpenGLContext* context = QOpenGLContext::currentContext();
59
60 // If owned by a context object make sure it is current.
61 // Also check that current context is capable of resolving all needed functions
62 if (((owningContext() && owningContext() == context) || !owningContext())
63 && QOpenGLFunctions_1_0::isContextCompatible(context))
64 {
65 // Associate with private implementation, creating if necessary
66 // Function pointers in the backends are resolved at creation time
67 QOpenGLVersionFunctionsBackend* d = nullptr;
68 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_CoreBackend::versionStatus());
69 d_1_0_Core = static_cast<QOpenGLFunctions_1_0_CoreBackend*>(d);
70 d->refs.ref();
71
72 d = QAbstractOpenGLFunctionsPrivate::functionsBackend(context, QOpenGLFunctions_1_0_DeprecatedBackend::versionStatus());
73 d_1_0_Deprecated = static_cast<QOpenGLFunctions_1_0_DeprecatedBackend*>(d);
74 d->refs.ref();
75
76 QAbstractOpenGLFunctions::initializeOpenGLFunctions();
77 }
78 return isInitialized();
79}
80
81bool QOpenGLFunctions_1_0::isContextCompatible(QOpenGLContext *context)
82{
83 Q_ASSERT(context);
84 QSurfaceFormat f = context->format();
85 const auto v = std::pair(f.majorVersion(), f.minorVersion());
86 if (v < std::pair(1, 0))
87 return false;
88
89 if (f.profile() == QSurfaceFormat::CoreProfile)
90 return false;
91
92 return true;
93}
94
95QOpenGLVersionProfile QOpenGLFunctions_1_0::versionProfile()
96{
97 QOpenGLVersionProfile v;
98 v.setVersion(1, 0);
99 return v;
100}
101
102QT_END_NAMESPACE
Combined button and popup list for selecting options.