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_es2.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// Qt-Security score:significant reason:default
4
7
9
10/*!
11 \class QOpenGLFunctions_ES2
12 \inmodule QtOpenGL
13 \since 5.1
14 \wrapper
15 \brief The QOpenGLFunctions_ES2 class provides all functions for OpenGL ES 2.
16
17 This class is a wrapper for OpenGL ES 2 functions. See reference pages on
18 \l {http://www.khronos.org/opengles/sdk/docs/man/}{khronos.org} for
19 function documentation.
20
21 \sa QAbstractOpenGLFunctions
22*/
23
24QOpenGLFunctions_ES2::QOpenGLFunctions_ES2()
25 : QAbstractOpenGLFunctions()
26 , d_es2(0)
27{
28}
29
30QOpenGLFunctions_ES2::~QOpenGLFunctions_ES2()
31{
32}
33
34bool QOpenGLFunctions_ES2::initializeOpenGLFunctions()
35{
36 if ( isInitialized() )
37 return true;
38
39 QOpenGLContext* context = QOpenGLContext::currentContext();
40
41 // If owned by a context object make sure it is current.
42 // Also check that current context is compatible
43 if (((owningContext() && owningContext() == context) || !owningContext())
44 && QOpenGLFunctions_ES2::isContextCompatible(context))
45 {
46 // Nothing to do, just flag that we are initialized
47 QAbstractOpenGLFunctions::initializeOpenGLFunctions();
48 }
49 return isInitialized();
50}
51
52bool QOpenGLFunctions_ES2::isContextCompatible(QOpenGLContext *context)
53{
54 Q_ASSERT(context);
55 QSurfaceFormat f = context->format();
56 const auto v = std::pair(f.majorVersion(), f.minorVersion());
57 if (v < std::pair(2, 0))
58 return false;
59 if (f.renderableType() != QSurfaceFormat::OpenGLES)
60 return false;
61
62 return true;
63}
64
65QOpenGLVersionProfile QOpenGLFunctions_ES2::versionProfile()
66{
67 QOpenGLVersionProfile v;
68 return v;
69}
70
71QT_END_NAMESPACE
Combined button and popup list for selecting options.