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
src_gui_opengl_qopenglfunctions.cpp
Go to the documentation of this file.
1// Copyright (C) 2018 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3#include <QOpenGLFunctions>
4#include <QtOpenGL/QOpenGLWindow>
5
6#include <QSurface>
7#include <QWidget>
8#include <QWindow>
9
11
13class MyGLWindow : public QWindow, protected QOpenGLFunctions
14{
16public:
17 explicit MyGLWindow(QScreen *screen = nullptr);
18
19protected:
20 void initializeGL();
21 void paintGL();
22
24};
25
28{
29 setSurfaceType(OpenGLSurface);
30 create();
31
32 // Create an OpenGL context
35
36 // Setup scene and render it
38 paintGL();
39};
40
47
48
49int textureId = 0;
50
53{
56 glBindTexture(GL_TEXTURE_2D, textureId);
57 // ...
60}
62
63
64void wrapper0() {
67glFuncs.glActiveTexture(GL_TEXTURE1);
69} // wrapper0
70
71
72void wrapper1() {
74QOpenGLFunctions *glFuncs = QOpenGLContext::currentContext()->functions();
75glFuncs->glActiveTexture(GL_TEXTURE1);
77
78
81bool npot = funcs.hasOpenGLFeature(QOpenGLFunctions::NPOTTextures);
83
84Q_UNUSED(npot);
85} // wrapper1
86} // src_gui_opengl_qopenglfunctions
\inmodule QtGui
bool create()
Attempts to create the OpenGL context with the current configuration.
bool makeCurrent(QSurface *surface)
Makes the context current in the current thread, against the given surface.
static QOpenGLContext * currentContext()
Returns the last context which called makeCurrent in the current thread, or \nullptr,...
void doneCurrent()
Convenience function for calling makeCurrent with a 0 surface.
void swapBuffers(QSurface *surface)
Swap the back and front buffers of surface.
The QOpenGLFunctions class provides cross-platform access to the OpenGL ES 2.0 API.
void glBindTexture(GLenum target, GLuint texture)
Convenience function that calls glBindTexture(target, texture).
void glActiveTexture(GLenum texture)
Convenience function that calls glActiveTexture(texture).
void initializeOpenGLFunctions()
Initializes OpenGL function resolution for the current context.
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
@ OpenGLSurface
Definition qsurface.h:32
\inmodule QtGui
Definition qwindow.h:63
static VulkanServerBufferGlFunctions * funcs
#define GL_TEXTURE1
Definition qopenglext.h:130
QScreen * screen
[1]
Definition main.cpp:29
#define Q_OBJECT
#define Q_UNUSED(x)
view create()