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.cpp File Reference

(b0056f052d842150305d59a3ced280e1885a8619)

#include "qopenglframebufferobject.h"
#include "qopenglframebufferobject_p.h"
#include <qdebug.h>
#include <private/qopengl_p.h>
#include <private/qopenglcontext_p.h>
#include <private/qopenglextensions_p.h>
#include <private/qfont_p.h>
#include <qwindow.h>
#include <qimage.h>
#include <QtCore/qbytearray.h>
#include <qtopengl_tracepoints_p.h>
+ Include dependency graph for qopenglframebufferobject.cpp:

Go to the source code of this file.

Macros

#define QT_RESET_GLERROR()
 
#define QT_CHECK_GLERROR()
 
#define GL_MAX_SAMPLES   0x8D57
 
#define GL_RENDERBUFFER_SAMPLES   0x8CAB
 
#define GL_DEPTH24_STENCIL8   0x88F0
 
#define GL_DEPTH_COMPONENT24   0x81A6
 
#define GL_DEPTH_COMPONENT24_OES   0x81A6
 
#define GL_READ_FRAMEBUFFER   0x8CA8
 
#define GL_DRAW_FRAMEBUFFER   0x8CA9
 
#define GL_RGB8   0x8051
 
#define GL_RGB10   0x8052
 
#define GL_RGB16   0x8054
 
#define GL_RGBA8   0x8058
 
#define GL_RGB10_A2   0x8059
 
#define GL_RGBA16   0x805B
 
#define GL_BGRA   0x80E1
 
#define GL_UNSIGNED_INT_8_8_8_8_REV   0x8367
 
#define GL_UNSIGNED_INT_2_10_10_10_REV   0x8368
 
#define GL_CONTEXT_LOST   0x0507
 
#define GL_DEPTH_STENCIL_ATTACHMENT   0x821A
 
#define GL_DEPTH_STENCIL   0x84F9
 
#define GL_HALF_FLOAT   0x140B
 
#define GL_RGBA32F   0x8814
 
#define GL_RGB32F   0x8815
 
#define GL_RGBA16F   0x881A
 
#define GL_RGB16F   0x881B
 

Functions

QT_BEGIN_NAMESPACE Q_TRACE_PREFIX (qtopengl, "#include <private/qopengl2pexvertexarray_p.h>" "#include <private/qopengltextureuploader_p.h>" "#include <qopenglframebufferobject.h>")
 
 Q_TRACE_PARAM_REPLACE (GLenum, int)
 
 Q_TRACE_PARAM_REPLACE (GLint, int)
 
 Q_TRACE_METADATA (qtopengl, "ENUM { } QOpenGLFramebufferObject::Attachment; ")
 
void Q_TRACE_INSTRUMENT (qtopengl) QOpenGLFramebufferObjectPrivate
 
static GLenum effectiveInternalFormat (GLenum internalFormat)
 
static QImage qt_gl_read_framebuffer_rgba8 (const QSize &size, bool include_alpha, QOpenGLContext *context)
 
static QImage qt_gl_read_framebuffer_rgb10a2 (const QSize &size, bool include_alpha, QOpenGLContext *context)
 
static QImage qt_gl_read_framebuffer_rgba16 (const QSize &size, bool include_alpha, QOpenGLContext *context)
 
static QImage qt_gl_read_framebuffer_rgba16f (const QSize &size, bool include_alpha, QOpenGLContext *context)
 
static QImage qt_gl_read_framebuffer_rgba32f (const QSize &size, bool include_alpha, QOpenGLContext *context)
 
static QImage qt_gl_read_framebuffer (const QSize &size, GLenum internal_format, bool include_alpha, bool flip)
 
Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer (const QSize &size, bool alpha_format, bool include_alpha)
 

Macro Definition Documentation

◆ GL_BGRA

#define GL_BGRA   0x80E1

Definition at line 105 of file qopenglframebufferobject.cpp.

Referenced by qt_gl_read_framebuffer_rgba8().

◆ GL_CONTEXT_LOST

#define GL_CONTEXT_LOST   0x0507

Definition at line 117 of file qopenglframebufferobject.cpp.

Referenced by qt_gl_read_framebuffer().

◆ GL_DEPTH24_STENCIL8

#define GL_DEPTH24_STENCIL8   0x88F0

Definition at line 61 of file qopenglframebufferobject.cpp.

◆ GL_DEPTH_COMPONENT24

#define GL_DEPTH_COMPONENT24   0x81A6

Definition at line 65 of file qopenglframebufferobject.cpp.

◆ GL_DEPTH_COMPONENT24_OES

#define GL_DEPTH_COMPONENT24_OES   0x81A6

Definition at line 69 of file qopenglframebufferobject.cpp.

◆ GL_DEPTH_STENCIL

#define GL_DEPTH_STENCIL   0x84F9

Definition at line 125 of file qopenglframebufferobject.cpp.

◆ GL_DEPTH_STENCIL_ATTACHMENT

#define GL_DEPTH_STENCIL_ATTACHMENT   0x821A

Definition at line 121 of file qopenglframebufferobject.cpp.

◆ GL_DRAW_FRAMEBUFFER

#define GL_DRAW_FRAMEBUFFER   0x8CA9

Definition at line 77 of file qopenglframebufferobject.cpp.

◆ GL_HALF_FLOAT

#define GL_HALF_FLOAT   0x140B

Definition at line 129 of file qopenglframebufferobject.cpp.

Referenced by qt_gl_read_framebuffer_rgba16f().

◆ GL_MAX_SAMPLES

#define GL_MAX_SAMPLES   0x8D57

Definition at line 53 of file qopenglframebufferobject.cpp.

◆ GL_READ_FRAMEBUFFER

#define GL_READ_FRAMEBUFFER   0x8CA8

Definition at line 73 of file qopenglframebufferobject.cpp.

◆ GL_RENDERBUFFER_SAMPLES

#define GL_RENDERBUFFER_SAMPLES   0x8CAB

Definition at line 57 of file qopenglframebufferobject.cpp.

◆ GL_RGB10

◆ GL_RGB10_A2

#define GL_RGB10_A2   0x8059

Definition at line 97 of file qopenglframebufferobject.cpp.

Referenced by qt_gl_read_framebuffer().

◆ GL_RGB16

#define GL_RGB16   0x8054

◆ GL_RGB16F

#define GL_RGB16F   0x881B

Definition at line 145 of file qopenglframebufferobject.cpp.

Referenced by qt_gl_read_framebuffer().

◆ GL_RGB32F

#define GL_RGB32F   0x8815

Definition at line 137 of file qopenglframebufferobject.cpp.

Referenced by qt_gl_read_framebuffer().

◆ GL_RGB8

#define GL_RGB8   0x8051

◆ GL_RGBA16

◆ GL_RGBA16F

#define GL_RGBA16F   0x881A

Definition at line 141 of file qopenglframebufferobject.cpp.

Referenced by qt_gl_read_framebuffer().

◆ GL_RGBA32F

#define GL_RGBA32F   0x8814

Definition at line 133 of file qopenglframebufferobject.cpp.

Referenced by qt_gl_read_framebuffer().

◆ GL_RGBA8

#define GL_RGBA8   0x8058

Definition at line 93 of file qopenglframebufferobject.cpp.

Referenced by qt_gl_read_framebuffer().

◆ GL_UNSIGNED_INT_2_10_10_10_REV

#define GL_UNSIGNED_INT_2_10_10_10_REV   0x8368

Definition at line 113 of file qopenglframebufferobject.cpp.

Referenced by qt_gl_read_framebuffer_rgb10a2().

◆ GL_UNSIGNED_INT_8_8_8_8_REV

#define GL_UNSIGNED_INT_8_8_8_8_REV   0x8367

Definition at line 109 of file qopenglframebufferobject.cpp.

Referenced by qt_gl_read_framebuffer_rgba8().

◆ QT_CHECK_GLERROR

#define QT_CHECK_GLERROR ( )
Value:
{ \
GLenum err = QOpenGLContext::currentContext()->functions()->glGetError(); \
if (err != GL_NO_ERROR && err != GL_CONTEXT_LOST) { \
qDebug("[%s line %d] OpenGL Error: %d", \
__FILE__, __LINE__, (int)err); \
} \
}
static QOpenGLContext * currentContext()
Returns the last context which called makeCurrent in the current thread, or \nullptr,...
typedef GLenum(GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC)(void)
#define GL_CONTEXT_LOST

Definition at line 39 of file qopenglframebufferobject.cpp.

Referenced by QOpenGLFramebufferObjectPrivate::initColorBuffer(), QOpenGLFramebufferObjectPrivate::initDepthStencilAttachments(), QOpenGLFramebufferObjectPrivate::initTexture(), and Q_TRACE_INSTRUMENT().

◆ QT_RESET_GLERROR

#define QT_RESET_GLERROR ( )
Value:
{ \
while (true) {\
GLenum error = QOpenGLContext::currentContext()->functions()->glGetError(); \
if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST) \
break; \
} \
}
DBusConnection const char DBusError * error

Definition at line 31 of file qopenglframebufferobject.cpp.

Referenced by Q_TRACE_INSTRUMENT().

Function Documentation

◆ effectiveInternalFormat()

static GLenum effectiveInternalFormat ( GLenum internalFormat)
inlinestatic

Definition at line 889 of file qopenglframebufferobject.cpp.

References QOpenGLContext::currentContext(), GL_RGBA, and GL_RGBA8.

Referenced by QOpenGLFramebufferObject::QOpenGLFramebufferObject(), QOpenGLFramebufferObject::QOpenGLFramebufferObject(), QOpenGLFramebufferObject::QOpenGLFramebufferObject(), and QOpenGLFramebufferObject::addColorAttachment().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Q_TRACE_INSTRUMENT()

◆ Q_TRACE_METADATA()

Q_TRACE_METADATA ( qtopengl ,
"ENUM { } QOpenGLFramebufferObject::Attachment; "  )

◆ Q_TRACE_PARAM_REPLACE() [1/2]

Q_TRACE_PARAM_REPLACE ( GLenum ,
int  )

◆ Q_TRACE_PARAM_REPLACE() [2/2]

Q_TRACE_PARAM_REPLACE ( GLint ,
int  )

◆ Q_TRACE_PREFIX()

QT_BEGIN_NAMESPACE Q_TRACE_PREFIX ( qtopengl ,
"#include <private/qopengl2pexvertexarray_p.h>" "#include <private/qopengltextureuploader_p.h>" "#include <qopenglframebufferobject.h>"  )

◆ qt_gl_read_framebuffer() [1/2]

Q_OPENGL_EXPORT QImage qt_gl_read_framebuffer ( const QSize & size,
bool alpha_format,
bool include_alpha )

Definition at line 1450 of file qopenglframebufferobject.cpp.

References GL_RGBA, and qt_gl_read_framebuffer().

+ Here is the call graph for this function:

◆ qt_gl_read_framebuffer() [2/2]

static QImage qt_gl_read_framebuffer ( const QSize & size,
GLenum internal_format,
bool include_alpha,
bool flip )
static

Definition at line 1412 of file qopenglframebufferobject.cpp.

References QOpenGLContext::currentContext(), error, funcs, GL_CONTEXT_LOST, GL_RGB10, GL_RGB10_A2, GL_RGB16, GL_RGB16F, GL_RGB32F, GL_RGB8, GL_RGBA, GL_RGBA16, GL_RGBA16F, GL_RGBA32F, GL_RGBA8, GLenum(), qt_gl_read_framebuffer_rgb10a2(), qt_gl_read_framebuffer_rgba16(), qt_gl_read_framebuffer_rgba16f(), qt_gl_read_framebuffer_rgba32f(), and qt_gl_read_framebuffer_rgba8().

Referenced by QOpenGLWindow::grabFramebuffer(), QOpenGLWidgetPrivate::grabFramebuffer(), qt_gl_read_framebuffer(), and QOpenGLFramebufferObject::toImage().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_gl_read_framebuffer_rgb10a2()

static QImage qt_gl_read_framebuffer_rgb10a2 ( const QSize & size,
bool include_alpha,
QOpenGLContext * context )
inlinestatic

Definition at line 1377 of file qopenglframebufferobject.cpp.

References context, QImage::Format_A2BGR30_Premultiplied, QImage::Format_BGR30, GL_RGBA, and GL_UNSIGNED_INT_2_10_10_10_REV.

Referenced by qt_gl_read_framebuffer().

+ Here is the caller graph for this function:

◆ qt_gl_read_framebuffer_rgba16()

static QImage qt_gl_read_framebuffer_rgba16 ( const QSize & size,
bool include_alpha,
QOpenGLContext * context )
inlinestatic

Definition at line 1386 of file qopenglframebufferobject.cpp.

References context, QImage::Format_RGBA64_Premultiplied, QImage::Format_RGBX64, and GL_RGBA.

Referenced by qt_gl_read_framebuffer().

+ Here is the caller graph for this function:

◆ qt_gl_read_framebuffer_rgba16f()

static QImage qt_gl_read_framebuffer_rgba16f ( const QSize & size,
bool include_alpha,
QOpenGLContext * context )
inlinestatic

Definition at line 1395 of file qopenglframebufferobject.cpp.

References context, QImage::Format_RGBA16FPx4_Premultiplied, QImage::Format_RGBX16FPx4, GL_HALF_FLOAT, and GL_RGBA.

Referenced by qt_gl_read_framebuffer().

+ Here is the caller graph for this function:

◆ qt_gl_read_framebuffer_rgba32f()

static QImage qt_gl_read_framebuffer_rgba32f ( const QSize & size,
bool include_alpha,
QOpenGLContext * context )
inlinestatic

Definition at line 1404 of file qopenglframebufferobject.cpp.

References context, QImage::Format_RGBA32FPx4_Premultiplied, QImage::Format_RGBX32FPx4, GL_FLOAT, and GL_RGBA.

Referenced by qt_gl_read_framebuffer().

+ Here is the caller graph for this function:

◆ qt_gl_read_framebuffer_rgba8()

static QImage qt_gl_read_framebuffer_rgba8 ( const QSize & size,
bool include_alpha,
QOpenGLContext * context )
inlinestatic

Definition at line 1353 of file qopenglframebufferobject.cpp.

References context, QImage::Format_ARGB32_Premultiplied, QImage::Format_RGB32, QImage::Format_RGBA8888_Premultiplied, QImage::Format_RGBX8888, funcs, GL_BGRA, GL_RGBA, GL_UNSIGNED_BYTE, and GL_UNSIGNED_INT_8_8_8_8_REV.

Referenced by qt_gl_read_framebuffer().

+ Here is the caller graph for this function: