Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4
#include "
qopenglfunctions_es2.h
"
5
#include "
qopenglcontext.h
"
6
7
QT_BEGIN_NAMESPACE
8
23
QOpenGLFunctions_ES2::QOpenGLFunctions_ES2()
24
:
QAbstractOpenGLFunctions
()
25
, d_es2(0)
26
{
27
}
28
29
QOpenGLFunctions_ES2::~QOpenGLFunctions_ES2()
30
{
31
}
32
33
bool
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
51
bool
QOpenGLFunctions_ES2::isContextCompatible(
QOpenGLContext
*
context
)
52
{
53
Q_ASSERT
(
context
);
54
QSurfaceFormat
f
=
context
->format();
55
const
QPair<int, int>
v
=
qMakePair
(
f
.majorVersion(),
f
.minorVersion());
56
if
(
v
<
qMakePair
(2, 0))
57
return
false
;
58
if
(
f
.renderableType() !=
QSurfaceFormat::OpenGLES
)
59
return
false
;
60
61
return
true
;
62
}
63
64
QOpenGLVersionProfile
QOpenGLFunctions_ES2::versionProfile()
65
{
66
QOpenGLVersionProfile
v
;
67
return
v
;
68
}
69
70
QT_END_NAMESPACE
QAbstractOpenGLFunctions
\inmodule QtOpenGL
Definition
qopenglversionfunctions.h:175
QAbstractOpenGLFunctions::initializeOpenGLFunctions
virtual bool initializeOpenGLFunctions()
Definition
qopenglversionfunctions.cpp:257
QOpenGLContext
\inmodule QtGui
Definition
qopenglcontext.h:67
QOpenGLContext::currentContext
static QOpenGLContext * currentContext()
Returns the last context which called makeCurrent in the current thread, or \nullptr,...
Definition
qopenglcontext.cpp:228
QOpenGLVersionProfile
\inmodule QtOpenGL
Definition
qopenglversionprofile.h:20
QSurfaceFormat
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
Definition
qsurfaceformat.h:17
QSurfaceFormat::OpenGLES
@ OpenGLES
Definition
qsurfaceformat.h:41
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qstandardpaths_haiku.cpp:21
QT_END_NAMESPACE
Definition
qsharedpointer.cpp:1590
context
static void * context
Definition
qandroidaudiosource.cpp:42
qopenglcontext.h
v
GLsizei const GLfloat * v
[13]
Definition
qopengles2ext.h:788
f
GLfloat GLfloat f
Definition
qopengles2ext.h:795
qopenglfunctions_es2.h
qMakePair
QT_BEGIN_NAMESPACE constexpr decltype(auto) qMakePair(T1 &&value1, T2 &&value2) noexcept(noexcept(std::make_pair(std::forward< T1 >(value1), std::forward< T2 >(value2))))
Definition
qpair.h:19
Q_ASSERT
#define Q_ASSERT(cond)
Definition
qrandom.cpp:47
qtbase
src
opengl
qopenglfunctions_es2.cpp
Generated by
1.10.0