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