1/****************************************************************************
2**
3** Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38**
39** This file was generated by glgen version 0.1
40** Command line was: glgen
41**
42** glgen is Copyright (C) 2013 Klaralvdalens Datakonsult AB (KDAB)
43**
44** This is an auto-generated file.
45** Do not edit! All changes made to it will be lost.
46**
47****************************************************************************/
48
49#include "qopenglversionfunctionsfactory_p.h"
50
51#if !defined(QT_OPENGL_ES_2)
52#include "qopenglfunctions_4_5_core.h"
53#include "qopenglfunctions_4_5_compatibility.h"
54#include "qopenglfunctions_4_4_core.h"
55#include "qopenglfunctions_4_4_compatibility.h"
56#include "qopenglfunctions_4_3_core.h"
57#include "qopenglfunctions_4_3_compatibility.h"
58#include "qopenglfunctions_4_2_core.h"
59#include "qopenglfunctions_4_2_compatibility.h"
60#include "qopenglfunctions_4_1_core.h"
61#include "qopenglfunctions_4_1_compatibility.h"
62#include "qopenglfunctions_4_0_core.h"
63#include "qopenglfunctions_4_0_compatibility.h"
64#include "qopenglfunctions_3_3_core.h"
65#include "qopenglfunctions_3_3_compatibility.h"
66#include "qopenglfunctions_3_2_core.h"
67#include "qopenglfunctions_3_2_compatibility.h"
68#include "qopenglfunctions_3_1.h"
69#include "qopenglfunctions_3_0.h"
70#include "qopenglfunctions_2_1.h"
71#include "qopenglfunctions_2_0.h"
72#include "qopenglfunctions_1_5.h"
73#include "qopenglfunctions_1_4.h"
74#include "qopenglfunctions_1_3.h"
75#include "qopenglfunctions_1_2.h"
76#include "qopenglfunctions_1_1.h"
77#include "qopenglfunctions_1_0.h"
78#else
79#include "qopenglfunctions_es2.h"
80#endif
81
82QT_BEGIN_NAMESPACE
83
84QAbstractOpenGLFunctions *QOpenGLVersionFunctionsFactory::create(const QOpenGLVersionProfile &versionProfile)
85{
86#if !defined(QT_OPENGL_ES_2)
87 const int major = versionProfile.version().first;
88 const int minor = versionProfile.version().second;
89
90 if (versionProfile.hasProfiles()) {
91 switch (versionProfile.profile()) {
92 case QSurfaceFormat::CoreProfile:
93 if (major == 4 && minor == 5)
94 return new QOpenGLFunctions_4_5_Core;
95 else if (major == 4 && minor == 4)
96 return new QOpenGLFunctions_4_4_Core;
97 else if (major == 4 && minor == 3)
98 return new QOpenGLFunctions_4_3_Core;
99 else if (major == 4 && minor == 2)
100 return new QOpenGLFunctions_4_2_Core;
101 else if (major == 4 && minor == 1)
102 return new QOpenGLFunctions_4_1_Core;
103 else if (major == 4 && minor == 0)
104 return new QOpenGLFunctions_4_0_Core;
105 else if (major == 3 && minor == 3)
106 return new QOpenGLFunctions_3_3_Core;
107 else if (major == 3 && minor == 2)
108 return new QOpenGLFunctions_3_2_Core;
109 break;
110
111 case QSurfaceFormat::CompatibilityProfile:
112 if (major == 4 && minor == 5)
113 return new QOpenGLFunctions_4_5_Compatibility;
114 else if (major == 4 && minor == 4)
115 return new QOpenGLFunctions_4_4_Compatibility;
116 else if (major == 4 && minor == 3)
117 return new QOpenGLFunctions_4_3_Compatibility;
118 else if (major == 4 && minor == 2)
119 return new QOpenGLFunctions_4_2_Compatibility;
120 else if (major == 4 && minor == 1)
121 return new QOpenGLFunctions_4_1_Compatibility;
122 else if (major == 4 && minor == 0)
123 return new QOpenGLFunctions_4_0_Compatibility;
124 else if (major == 3 && minor == 3)
125 return new QOpenGLFunctions_3_3_Compatibility;
126 else if (major == 3 && minor == 2)
127 return new QOpenGLFunctions_3_2_Compatibility;
128 break;
129
130 case QSurfaceFormat::NoProfile:
131 default:
132 break;
133 };
134 } else {
135 if (major == 3 && minor == 1)
136 return new QOpenGLFunctions_3_1;
137 else if (major == 3 && minor == 0)
138 return new QOpenGLFunctions_3_0;
139 else if (major == 2 && minor == 1)
140 return new QOpenGLFunctions_2_1;
141 else if (major == 2 && minor == 0)
142 return new QOpenGLFunctions_2_0;
143 else if (major == 1 && minor == 5)
144 return new QOpenGLFunctions_1_5;
145 else if (major == 1 && minor == 4)
146 return new QOpenGLFunctions_1_4;
147 else if (major == 1 && minor == 3)
148 return new QOpenGLFunctions_1_3;
149 else if (major == 1 && minor == 2)
150 return new QOpenGLFunctions_1_2;
151 else if (major == 1 && minor == 1)
152 return new QOpenGLFunctions_1_1;
153 else if (major == 1 && minor == 0)
154 return new QOpenGLFunctions_1_0;
155 }
156 return nullptr;
157#else
158 Q_UNUSED(versionProfile);
159 return new QOpenGLFunctions_ES2;
160#endif
161}
162
163QT_END_NAMESPACE
164

source code of qtbase/src/gui/opengl/qopenglversionfunctionsfactory.cpp