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
5#include "qopenglcontext.h"
6
8
23QOpenGLFunctions_ES2::QOpenGLFunctions_ES2()
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
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
47 }
48 return isInitialized();
49}
50
51bool QOpenGLFunctions_ES2::isContextCompatible(QOpenGLContext *context)
52{
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
64QOpenGLVersionProfile QOpenGLFunctions_ES2::versionProfile()
65{
67 return v;
68}
69
\inmodule QtGui
static QOpenGLContext * currentContext()
Returns the last context which called makeCurrent in the current thread, or \nullptr,...
The QSurfaceFormat class represents the format of a QSurface. \inmodule QtGui.
Combined button and popup list for selecting options.
static void * context
GLsizei const GLfloat * v
[13]
GLfloat GLfloat f
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
#define Q_ASSERT(cond)
Definition qrandom.cpp:47