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
qopengltextureblitter.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
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
5#ifndef QOPENGLTEXTUREBLITTER_H
6#define QOPENGLTEXTUREBLITTER_H
7
8#include <QtOpenGL/qtopenglglobal.h>
9
10#include <QtGui/qopengl.h>
11#include <QtGui/QMatrix3x3>
12#include <QtGui/QMatrix4x4>
13
14QT_BEGIN_NAMESPACE
15
16class QOpenGLTextureBlitterPrivate;
17
18class Q_OPENGL_EXPORT QOpenGLTextureBlitter
19{
20public:
21 QOpenGLTextureBlitter();
22 ~QOpenGLTextureBlitter();
23
24 enum Origin {
25 OriginBottomLeft,
26 OriginTopLeft
27 };
28
29 bool create();
30 bool isCreated() const;
31 void destroy();
32
33 bool supportsExternalOESTarget() const;
34 bool supportsRectangleTarget() const;
35
36 void bind(GLenum target = GL_TEXTURE_2D);
37 void release();
38
39 void setRedBlueSwizzle(bool swizzle);
40 void setOpacity(float opacity);
41
42 void blit(GLuint texture, const QMatrix4x4 &targetTransform, Origin sourceOrigin);
43 void blit(GLuint texture, const QMatrix4x4 &targetTransform, const QMatrix3x3 &sourceTransform);
44
45 static QMatrix4x4 targetTransform(const QRectF &target, const QRect &viewport);
46 static QMatrix3x3 sourceTransform(const QRectF &subTexture, const QSize &textureSize, Origin origin);
47
48private:
49 Q_DISABLE_COPY(QOpenGLTextureBlitter)
50 Q_DECLARE_PRIVATE(QOpenGLTextureBlitter)
51 QScopedPointer<QOpenGLTextureBlitterPrivate> d_ptr;
52};
53
54QT_END_NAMESPACE
55
56#endif //QOPENGLTEXTUREBLITTER_H
QBlitterTextureBinder(GLenum target, GLuint textureId)
QMatrix3x3 toTextureCoordinates(const QMatrix3x3 &sourceTransform) const
void blit(GLuint texture, const QMatrix4x4 &targetTransform, QOpenGLTextureBlitter::Origin origin)
QOpenGLTextureBlitterPrivate(QOpenGLTextureBlitter *q_ptr)
QScopedPointer< QOpenGLVertexArrayObject > vao
bool buildProgram(ProgramIndex idx, const char *vs, const char *fs)
void blit(GLuint texture, const QMatrix4x4 &targetTransform, const QMatrix3x3 &sourceTransform)
bool prepareProgram(const QMatrix4x4 &vertexTransform)
The QOpenGLTextureBlitter class provides a convenient way to draw textured quads via OpenGL.
Combined button and popup list for selecting options.
#define GL_TEXTURE_EXTERNAL_OES
#define GL_TEXTURE_RECTANGLE
#define GL_TEXTURE_WIDTH
static const char fragment_shader_external_oes[]
static const char fragment_shader150[]
static const char vertex_shader[]
#define GL_TEXTURE_HEIGHT
static const GLfloat texture_buffer_data[]
static const char fragment_shader150_rectangle[]
static const GLfloat vertex_buffer_data[]
static const char fragment_shader_rectangle[]
static QOpenGLTextureBlitterPrivate::ProgramIndex targetToProgramIndex(GLenum target)
static const char fragment_shader[]
static const char vertex_shader150[]
QScopedPointer< QOpenGLShaderProgram > glProgram