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
4#ifndef QOPENGLTEXTUREBLITTER_H
5#define QOPENGLTEXTUREBLITTER_H
6
7#include <QtOpenGL/qtopenglglobal.h>
8
9#include <QtGui/qopengl.h>
10#include <QtGui/QMatrix3x3>
11#include <QtGui/QMatrix4x4>
12
13QT_BEGIN_NAMESPACE
14
15class QOpenGLTextureBlitterPrivate;
16
17class Q_OPENGL_EXPORT QOpenGLTextureBlitter
18{
19public:
20 QOpenGLTextureBlitter();
21 ~QOpenGLTextureBlitter();
22
23 enum Origin {
24 OriginBottomLeft,
25 OriginTopLeft
26 };
27
28 bool create();
29 bool isCreated() const;
30 void destroy();
31
32 bool supportsExternalOESTarget() const;
33 bool supportsRectangleTarget() const;
34
35 void bind(GLenum target = GL_TEXTURE_2D);
36 void release();
37
38 void setRedBlueSwizzle(bool swizzle);
39 void setOpacity(float opacity);
40
41 void blit(GLuint texture, const QMatrix4x4 &targetTransform, Origin sourceOrigin);
42 void blit(GLuint texture, const QMatrix4x4 &targetTransform, const QMatrix3x3 &sourceTransform);
43
44 static QMatrix4x4 targetTransform(const QRectF &target, const QRect &viewport);
45 static QMatrix3x3 sourceTransform(const QRectF &subTexture, const QSize &textureSize, Origin origin);
46
47private:
48 Q_DISABLE_COPY(QOpenGLTextureBlitter)
49 Q_DECLARE_PRIVATE(QOpenGLTextureBlitter)
50 QScopedPointer<QOpenGLTextureBlitterPrivate> d_ptr;
51};
52
53QT_END_NAMESPACE
54
55#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