6#include <QOpenGLFramebufferObject>
7#include <QOpenGLFunctions>
8#include <private/qquickitem_p.h>
9#include <private/qsgadaptationlayer_p.h>
13#include <QSGSimpleTextureNode>
14#include <QSGRendererInterface>
15#include <QQuickOpenGLUtils>
111 if (
d->followsItemSize == follows)
113 d->followsItemSize = follows;
120 return d->followsItemSize;
138 if (
d->mirrorVertically ==
enable)
148 return d->mirrorVertically;
159 if (newGeometry.
size() != oldGeometry.
size() &&
d->followsItemSize)
205 window->beginExternalCommands();
216 window->endExternalCommands();
268 if (!
isOpenGL(
d->sceneGraphRenderContext()))
278 n->renderer->data =
n;
284 n->renderer->synchronize(
this);
286 QSize minFboSize =
d->sceneGraphContext()->minimumFBOSize();
290 n->devicePixelRatio =
window()->effectiveDevicePixelRatio();
291 desiredFboSize *=
n->devicePixelRatio;
293 if (
n->fbo && ((
d->followsItemSize &&
n->fbo->size() != desiredFboSize) ||
n->invalidatePending)) {
297 delete n->msDisplayFbo;
298 n->msDisplayFbo =
nullptr;
299 n->invalidatePending =
false;
303 n->fbo =
n->renderer->createFramebufferObject(desiredFboSize);
305 GLuint displayTexture =
n->fbo->texture();
307 if (
n->fbo->format().samples() > 0) {
309 displayTexture =
n->msDisplayFbo->texture();
312 QSGTexture *
wrapper = QNativeInterface::QSGOpenGLTexture::fromNative(displayTexture,
315 QQuickWindow::TextureHasAlphaChannel);
350 qWarning(
"QQuickFramebufferObject::textureProvider: can only be queried on the rendering thread of an exposed window");
353 if (!
isOpenGL(
d->sceneGraphRenderContext()))
372void QQuickFramebufferObject::invalidateSceneGraph()
518#include "qquickframebufferobject.moc"
519#include "moc_qquickframebufferobject.cpp"
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QThread * thread() const
Returns the thread in which the object lives.
static QOpenGLContext * currentContext()
Returns the last context which called makeCurrent in the current thread, or \nullptr,...
QOpenGLFunctions * functions() const
Get the QOpenGLFunctions instance for this context.
The QOpenGLFramebufferObject class encapsulates an OpenGL framebuffer object.
int height() const
Returns the height of the framebuffer object attachments.
static void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex, FramebufferRestorePolicy restorePolicy)
int width() const
Returns the width of the framebuffer object attachments.
static bool bindDefault()
Switches rendering back to the default, windowing system provided framebuffer.
bool bind()
Switches rendering from the default, windowing system provided framebuffer to this framebuffer object...
void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
Convenience function that calls glViewport(x, y, width, height).
QSGFramebufferObjectNode * node
QQuickFramebufferObjectPrivate()
virtual ~Renderer()
The Renderer is automatically deleted when the scene graph resources for the QQuickFramebufferObject ...
void update()
Call this function when the FBO should be rendered again.
virtual void render()=0
This function is called when the FBO should be rendered into.
virtual QOpenGLFramebufferObject * createFramebufferObject(const QSize &size)
This function is called when a new FBO is needed.
void invalidateFramebufferObject()
Call this function during synchronize() to invalidate the current FBO.
Renderer()
Constructs a new renderer.
QOpenGLFramebufferObject * framebufferObject() const
Returns the framebuffer object currently being rendered to.
virtual void synchronize(QQuickFramebufferObject *)
This function is called as a result of QQuickFramebufferObject::update().
QSGNode * updatePaintNode(QSGNode *, UpdatePaintNodeData *) override
bool textureFollowsItemSize
This property controls if the size of the FBO's texture should follow the dimensions of the QQuickFra...
void setMirrorVertically(bool enable)
void releaseResources() override
\reimp
bool mirrorVertically
This property controls if the size of the FBO's contents should be mirrored vertically when drawing.
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
void setTextureFollowsItemSize(bool follows)
QQuickFramebufferObject(QQuickItem *parent=nullptr)
Constructs a new QQuickFramebufferObject with parent parent.
bool isTextureProvider() const override
\reimp
QSGTextureProvider * textureProvider() const override
\reimp
virtual Renderer * createRenderer() const =0
Reimplement this function to create a renderer used to render into the FBO.
void mirrorVerticallyChanged(bool)
void textureFollowsItemSizeChanged(bool)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
void setFlag(Flag flag, bool enabled=true)
Enables the specified flag for this item if enabled is true; if enabled is false, the flag is disable...
virtual void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
virtual QSGTextureProvider * textureProvider() const
Returns the texture provider for an item.
QQuickWindow * window() const
Returns the window in which this item is rendered.
qreal width
This property holds the width of this item.
qreal height
This property holds the height of this item.
void update()
Schedules a call to updatePaintNode() for this item.
virtual bool isTextureProvider() const
Returns true if this item is a texture provider.
static QQuickWindowPrivate * get(QQuickWindow *c)
QSGRenderContext * context
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
void update()
Schedules the window to render another frame.
\inmodule QtCore\reentrant
constexpr QSizeF size() const noexcept
Returns the size of the rectangle.
virtual QSGRendererInterface * rendererInterface(QSGRenderContext *renderContext)
Returns a pointer to the (presumably) global renderer interface.
QQuickFramebufferObject * quickFbo
QSGTexture * texture() const override
Returns a pointer to the texture object.
QOpenGLFramebufferObject * msDisplayFbo
void handleScreenChange()
QOpenGLFramebufferObject * fbo
QSGFramebufferObjectNode()
~QSGFramebufferObjectNode()
QQuickFramebufferObject::Renderer * renderer
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
QSGContext * sceneGraphContext() const
An interface providing access to some of the graphics API specific internals of the scenegraph.
virtual GraphicsApi graphicsApi() const =0
Returns the graphics API that is in use by the Qt Quick scenegraph.
The QSGSimpleTextureNode class is provided for convenience to easily draw textured content using the ...
QSGTexture * texture() const
Returns the texture for this texture node.
The QSGTextureProvider class encapsulates texture based entities in QML.
void textureChanged()
This signal is emitted when the texture changes.
The QScreen class is used to query screen properties. \inmodule QtGui.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
static QThread * currentThread()
Q_QUICK_EXPORT void resetOpenGLState()
Call this function to reset the current OpenGL context its default state.
Combined button and popup list for selecting options.
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
static bool isOpenGL(QSGRenderContext *rc)
void qsgnode_set_description(QSGNode *node, const QString &description)
#define QStringLiteral(str)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent