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
qopenglframebufferobject.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 QOPENGLFRAMEBUFFEROBJECT_H
5#define QOPENGLFRAMEBUFFEROBJECT_H
6
7#include <QtOpenGL/qtopenglglobal.h>
8
9#include <QtGui/qopengl.h>
10#include <QtGui/qpaintdevice.h>
11
12#include <QtCore/qscopedpointer.h>
13
14#if defined(Q_QDOC)
15#undef GLuint
16typedef unsigned int GLuint;
17#undef GLenum
18typedef unsigned int GLenum;
19#undef GL_TEXTURE_2D
20#define GL_TEXTURE_2D 0x0DE1
21#undef GLbitfield
22typedef unsigned int GLbitfield;
23#endif
24
26
29
30class Q_OPENGL_EXPORT QOpenGLFramebufferObject
31{
32 Q_DECLARE_PRIVATE(QOpenGLFramebufferObject)
33public:
39
40 explicit QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D);
41 QOpenGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D);
42
44 GLenum target = GL_TEXTURE_2D, GLenum internalFormat = 0);
46 GLenum target = GL_TEXTURE_2D, GLenum internalFormat = 0);
47
50
52
53 void addColorAttachment(const QSize &size, GLenum internalFormat = 0);
54 void addColorAttachment(int width, int height, GLenum internalFormat = 0);
55
57
58 bool isValid() const;
59 bool isBound() const;
60 bool bind();
61 bool release();
62
63 int width() const { return size().width(); }
64 int height() const { return size().height(); }
65
66 GLuint texture() const;
67 QList<GLuint> textures() const;
68
69 GLuint takeTexture();
70 GLuint takeTexture(int colorAttachmentIndex);
71
72 QSize size() const;
73 QList<QSize> sizes() const;
74
75 QImage toImage(bool flipped = true) const;
76 QImage toImage(bool flipped, int colorAttachmentIndex) const;
77
78 Attachment attachment() const;
79 void setAttachment(Attachment attachment);
80
81 GLuint handle() const;
82
83 static bool bindDefault();
84
85 static bool hasOpenGLFramebufferObjects();
86
87 static bool hasOpenGLFramebufferBlit();
88
94
95 static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect,
96 QOpenGLFramebufferObject *source, const QRect &sourceRect,
99 int readColorAttachmentIndex,
100 int drawColorAttachmentIndex,
101 FramebufferRestorePolicy restorePolicy);
102 static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect,
103 QOpenGLFramebufferObject *source, const QRect &sourceRect,
106 int readColorAttachmentIndex,
107 int drawColorAttachmentIndex);
108 static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect,
109 QOpenGLFramebufferObject *source, const QRect &sourceRect,
110 GLbitfield buffers = GL_COLOR_BUFFER_BIT,
111 GLenum filter = GL_NEAREST);
112 static void blitFramebuffer(QOpenGLFramebufferObject *target,
114 GLbitfield buffers = GL_COLOR_BUFFER_BIT,
115 GLenum filter = GL_NEAREST);
116
117private:
118 Q_DISABLE_COPY(QOpenGLFramebufferObject)
119 QScopedPointer<QOpenGLFramebufferObjectPrivate> d_ptr;
120 friend class QOpenGLPaintDevice;
121 friend class QOpenGLFBOGLPaintDevice;
122};
123
126{
127public:
132
133 void setSamples(int samples);
134 int samples() const;
135
136 void setMipmap(bool enabled);
137 bool mipmap() const;
138
141
142 void setTextureTarget(GLenum target);
143 GLenum textureTarget() const;
144
145 void setInternalTextureFormat(GLenum internalTextureFormat);
146 GLenum internalTextureFormat() const;
147
150
151private:
153
154 void detach();
155};
156
158
159#endif // QOPENGLFRAMEBUFFEROBJECT_H
\inmodule QtGui
Definition qimage.h:37
The QOpenGLFramebufferObjectFormat class specifies the format of an OpenGL framebuffer object.
The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer object.
int height() const
Returns the height of the framebuffer object attachments.
int width() const
Returns the width of the framebuffer object attachments.
Attachment
This enum type is used to configure the depth and stencil buffers attached to the framebuffer object ...
The QOpenGLPaintDevice class enables painting to an OpenGL context using QPainter.
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtCore
Definition qsize.h:25
Combined button and popup list for selecting options.
constexpr bool operator!=(const timespec &t1, const timespec &t2)
GLuint64 GLenum void * handle
GLuint const GLuint * buffers
GLsizei samples
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint const GLuint GLuint const GLuint * textures
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei width
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
GLenum target
GLenum GLuint texture
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLenum attachment
GLint GLsizei GLsizei GLenum format
GLsizei GLenum internalFormat
GLsizei GLsizei GLchar * source
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
typedef GLbitfield(APIENTRYP PFNGLQUERYMATRIXXOESPROC)(GLfixed *mantissa
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
Definition qrandom.cpp:1220
#define GLuint
sem release()
QSharedPointer< T > other(t)
[5]
socketLayer bind(QHostAddress::Any, 4000)