In questa pagina

QOpenGLFramebufferObject Class

La classe QOpenGLFramebufferObject incapsula un oggetto framebuffer OpenGL. Per saperne di più...

Intestazione: #include <QOpenGLFramebufferObject>
CMake: find_package(Qt6 REQUIRED COMPONENTS OpenGL)
target_link_libraries(mytarget PRIVATE Qt6::OpenGL)
qmake: QT += opengl

Tipi pubblici

enum Attachment { NoAttachment, CombinedDepthStencil, Depth }
enum FramebufferRestorePolicy { DontRestoreFramebufferBinding, RestoreFramebufferBindingToDefault, RestoreFrameBufferBinding }

Funzioni pubbliche

QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D)
QOpenGLFramebufferObject(const QSize &size, const QOpenGLFramebufferObjectFormat &format)
QOpenGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D)
QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format)
QOpenGLFramebufferObject(const QSize &size, QOpenGLFramebufferObject::Attachment attachment, GLenum target = GL_TEXTURE_2D, GLenum internalFormat = 0)
QOpenGLFramebufferObject(int width, int height, QOpenGLFramebufferObject::Attachment attachment, GLenum target = GL_TEXTURE_2D, GLenum internalFormat = 0)
virtual ~QOpenGLFramebufferObject()
void addColorAttachment(const QSize &size, GLenum internalFormat = 0)
void addColorAttachment(int width, int height, GLenum internalFormat = 0)
QOpenGLFramebufferObject::Attachment attachment() const
bool bind()
QOpenGLFramebufferObjectFormat format() const
GLuint handle() const
int height() const
bool isBound() const
bool isValid() const
bool release()
void setAttachment(QOpenGLFramebufferObject::Attachment attachment)
QSize size() const
QList<QSize> sizes() const
GLuint takeTexture()
GLuint takeTexture(int colorAttachmentIndex)
GLuint texture() const
QList<GLuint> textures() const
QImage toImage(bool flipped = true) const
QImage toImage(bool flipped, int colorAttachmentIndex) const
int width() const

Membri pubblici statici

bool bindDefault()
void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex, QOpenGLFramebufferObject::FramebufferRestorePolicy restorePolicy)
void blitFramebuffer(QOpenGLFramebufferObject *target, QOpenGLFramebufferObject *source, GLbitfield buffers = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST)
void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST)
void blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex)
bool hasOpenGLFramebufferBlit()
bool hasOpenGLFramebufferObjects()

Descrizione dettagliata

La classe QOpenGLFramebufferObject incapsula un oggetto framebuffer OpenGL, definito dall'estensione GL_EXT_framebuffer_object. Fornisce una superficie di rendering su cui è possibile disegnare con un oggetto QPainter con l'ausilio di QOpenGLPaintDevice, oppure su cui è possibile eseguire il rendering utilizzando chiamate OpenGL native. Questa superficie può essere associata e utilizzata come una normale texture nel proprio codice di disegno OpenGL. Per impostazione predefinita, la classe `QOpenGLFramebufferObject` genera una texture OpenGL 2D (utilizzando il target ` GL_TEXTURE_2D `), che viene utilizzata come target di rendering interno.

È importante disporre di un contesto OpenGL attivo al momento della creazione di un QOpenGLFramebufferObject, altrimenti l’inizializzazione fallirà.

Creare l’istanza di `QOpenGLFrameBufferObject` con l’attaccamento ` CombinedDepthStencil ` se si desidera che l’ QPainter o venga renderizzato correttamente. Si noti che è necessario creare un QOpenGLFramebufferObject con più di un campione per pixel affinché le primitive siano sottoposte ad antialiasing durante il disegno utilizzando un QPainter. Per creare un oggetto framebuffer multisample, è necessario utilizzare uno dei costruttori che accettano un parametro QOpenGLFramebufferObjectFormat e impostare la proprietà QOpenGLFramebufferObjectFormat::samples() su un valore diverso da zero.

Per gli oggetti framebuffer multisample viene creato un buffer di rendering a colori, altrimenti viene creata una texture con il target di texture specificato. Il buffer di rendering a colori o la texture avranno il formato interno specificato e saranno associati all’attaccamento GL_COLOR_ATTACHMENT0 nell’oggetto framebuffer.

Sono supportati anche più target di rendering, qualora l'implementazione OpenGL lo consenta. In questo caso saranno presenti più texture (o, in caso di multisampling, buffer di rendering) e ciascuna di esse verrà associata a GL_COLOR_ATTACHMENT0, 1, 2, ...

Se si desidera utilizzare come texture un oggetto framebuffer con il multisampling abilitato, è necessario prima copiarne il contenuto in un normale oggetto framebuffer utilizzando `QOpenGLContext::blitFramebuffer()`.

È possibile disegnare all’interno di un QOpenGLFramebufferObject utilizzando QPainter e QOpenGLPaintDevice in un thread separato.

Documentazione sui tipi dei membri

enum QOpenGLFramebufferObject::Attachment

Questo tipo di enumerazione viene utilizzato per configurare i buffer di profondità e stencil associati all'oggetto framebuffer al momento della sua creazione.

CostanteValoreDescrizione
QOpenGLFramebufferObject::NoAttachment0All'oggetto framebuffer non viene aggiunto alcun buffer. Si noti che i test di profondità e stencil di OpenGL non funzioneranno durante il rendering su un oggetto framebuffer privo di buffer di profondità o stencil. Questo è il valore predefinito.
QOpenGLFramebufferObject::CombinedDepthStencil1Se è presente l'estensione " GL_EXT_packed_depth_stencil ", viene associato un buffer combinato di profondità e stencil. Se l'estensione non è presente, viene associato solo un buffer di profondità.
QOpenGLFramebufferObject::Depth2All'oggetto framebuffer viene associato un buffer di profondità.

Vedi anche attachment().

enum QOpenGLFramebufferObject::FramebufferRestorePolicy

Questo tipo di enumerazione viene utilizzato per configurare il comportamento relativo al ripristino dei collegamenti del framebuffer quando si chiama la funzione ` blitFramebuffer()`.

CostanteValoreDescrizione
QOpenGLFramebufferObject::DontRestoreFramebufferBinding0Non ripristinare il precedente binding del framebuffer. Il chiamante è responsabile del monitoraggio e dell’impostazione del binding del framebuffer secondo necessità.
QOpenGLFramebufferObject::RestoreFramebufferBindingToDefault1Dopo l'operazione di blit, associare il framebuffer predefinito.
QOpenGLFramebufferObject::RestoreFrameBufferBinding2Ripristina il framebuffer associato in precedenza. Questa operazione può risultare costosa in termini di risorse, poiché richiede l'interrogazione del framebuffer attualmente associato.

Vedi anche blitFramebuffer().

Documentazione delle funzioni membro

[explicit] QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, GLenum target = GL_TEXTURE_2D)

Crea un oggetto framebuffer OpenGL e associa una texture OpenGL 2D al buffer delle dimensioni size. La texture viene associata al target GL_COLOR_ATTACHMENT0 nell'oggetto framebuffer.

Il parametro ` target ` viene utilizzato per specificare la destinazione della texture OpenGL. La destinazione predefinita è ` GL_TEXTURE_2D`. Si tenga presente che le texture ` GL_TEXTURE_2D ` devono avere larghezza e altezza che siano potenze di 2 (ad esempio 256x512), a meno che non si utilizzi OpenGL 2.0 o versioni successive.

Per impostazione predefinita, non vengono associati buffer di profondità e stencil. È possibile attivare o disattivare questa funzionalità utilizzando uno dei costruttori sovraccaricati.

Il formato interno predefinito delle texture è GL_RGBA8 per OpenGL desktop e GL_RGBA per OpenGL/ES.

È importante che sia impostato un contesto OpenGL valido al momento della creazione di QOpenGLFramebufferObject, altrimenti l’inizializzazione fallirà.

Vedi anche size(), texture() e attachment().

QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, const QOpenGLFramebufferObjectFormat &format)

Crea un oggetto framebuffer OpenGL dell'size e specificato, basato sull'format e fornito.

QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, GLenum target = GL_TEXTURE_2D)

Crea un oggetto framebuffer OpenGL e associa una texture OpenGL 2D al buffer specificato in width e height.

Vedi anche size() e texture().

QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, const QOpenGLFramebufferObjectFormat &format)

Crea un oggetto framebuffer OpenGL con i valori specificati per ` width ` e ` height `, in base all'oggetto ` format` fornito.

QOpenGLFramebufferObject::QOpenGLFramebufferObject(const QSize &size, QOpenGLFramebufferObject::Attachment attachment, GLenum target = GL_TEXTURE_2D, GLenum internalFormat = 0)

Crea un oggetto framebuffer OpenGL e associa una texture al buffer specificato in ` size`.

Il parametro ` attachment ` descrive la configurazione del buffer di profondità/stencil, ` target ` la destinazione della texture e ` internalFormat ` il formato interno della texture. La destinazione predefinita della texture è ` GL_TEXTURE_2D`, mentre il formato interno predefinito è ` GL_RGBA8 ` per OpenGL desktop e ` GL_RGBA ` per OpenGL/ES.

Vedi anche size(), texture() e attachment().

QOpenGLFramebufferObject::QOpenGLFramebufferObject(int width, int height, QOpenGLFramebufferObject::Attachment attachment, GLenum target = GL_TEXTURE_2D, GLenum internalFormat = 0)

Crea un oggetto framebuffer OpenGL e associa una texture al buffer specificato tramite i parametri ` width ` e ` height`.

Il parametro attachment descrive la configurazione del buffer di profondità/stencil, target la destinazione della texture e internalFormat il formato interno della texture. La destinazione predefinita della texture è GL_TEXTURE_2D, mentre il formato interno predefinito è GL_RGBA8 per OpenGL desktop e GL_RGBA per OpenGL/ES.

Vedi anche size(), texture() e attachment().

[virtual noexcept] QOpenGLFramebufferObject::~QOpenGLFramebufferObject()

Elimina l'oggetto framebuffer e libera tutte le risorse allocate.

void QOpenGLFramebufferObject::addColorAttachment(const QSize &size, GLenum internalFormat = 0)

Crea e associa una texture o un renderbuffer aggiuntivo con larghezza e altez size.

È sempre presente un allegato in GL_COLOR_ATTACHMENT0. Chiamare questa funzione per impostare allegati aggiuntivi in GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, ...

Quando ` internalFormat ` non è ` 0`, specifica il formato interno della texture o del renderbuffer. In caso contrario, viene utilizzato il valore predefinito `GL_RGBA` o `GL_RGBA8`.

Nota: questa funzione è operativa solo quando l’implementazione di OpenGL supporta più target di rendering (MRT). In caso contrario, la funzione non aggiungerà alcun allegato di colore aggiuntivo. Chiamare ` QOpenGLFunctions::hasOpenGLFeature()` con ` QOpenGLFunctions::MultipleRenderTargets ` in fase di esecuzione per verificare se l’MRT è supportato.

Nota: il formato interno degli allegati di colore può variare, ma potrebbero esserci limitazioni sulle combinazioni supportate, a seconda dei driver.

Nota: le dimensioni degli allegati di colore possono variare, ma il rendering è limitato all’area in cui è possibile inserire tutti gli allegati, secondo le specifiche OpenGL. Tuttavia, alcuni driver potrebbero non essere pienamente conformi a questo riguardo.

void QOpenGLFramebufferObject::addColorAttachment(int width, int height, GLenum internalFormat = 0)

Crea e associa una texture o un renderbuffer aggiuntivo delle dimensioni specificate in width e height.

Quando internalFormat non è 0, specifica il formato interno della texture o del renderbuffer. In caso contrario, viene utilizzato il valore predefinito GL_RGBA o GL_RGBA8.

Si tratta di una funzione sovraccaricata.

QOpenGLFramebufferObject::Attachment QOpenGLFramebufferObject::attachment() const

Restituisce lo stato dei buffer di profondità e stencil associati a questo oggetto framebuffer.

Vedi anche setAttachment().

bool QOpenGLFramebufferObject::bind()

Passa dal rendering predefinito, fornito dal sistema a finestre tramite il framebuffer, a questo oggetto framebuffer. Restituisce ` true ` in caso di esito positivo, altrimenti `false`.

Nota: se viene chiamata la funzione takeTexture(), viene creata una nuova texture e associata all'oggetto framebuffer. Questa operazione è potenzialmente costosa e modifica lo stato del contesto (la texture attualmente associata).

Vedi anche ` release()`.

[static] bool QOpenGLFramebufferObject::bindDefault()

Ripristina le impostazioni predefinite del framebuffer fornito dal sistema a finestre. Restituisce true in caso di esito positivo, false in caso contrario.

Vedi anche bind() e release().

[static] void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex, QOpenGLFramebufferObject::FramebufferRestorePolicy restorePolicy)

Esegue il blit dal rettangolo sourceRect nell'oggetto framebuffer source al rettangolo targetRect nell'oggetto framebuffer target.

Se source o target è pari a 0, verrà utilizzato il framebuffer predefinito al posto di un oggetto framebuffer come sorgente o destinazione, rispettivamente.

Questa funzione non avrà alcun effetto a meno che hasOpenGLFramebufferBlit() non restituisca true.

Il parametro buffers dovrebbe essere una maschera costituita da qualsiasi combinazione di GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT e GL_STENCIL_BUFFER_BIT. Qualsiasi tipo di buffer che non sia presente sia nel buffer di origine che in quello di destinazione viene ignorato.

I rettangoli sourceRect e targetRect possono avere dimensioni diverse; in questo caso buffers non deve contenere GL_DEPTH_BUFFER_BIT o GL_STENCIL_BUFFER_BIT. Il parametro filter deve essere impostato su GL_LINEAR o GL_NEAREST e specifica se, durante il ridimensionamento, si deve utilizzare l'interpolazione lineare o quella più vicina.

Se source è uguale a target, viene eseguita una copia all'interno dello stesso buffer. I risultati sono indefiniti se i rettangoli di origine e di destinazione si sovrappongono e hanno dimensioni diverse. Le dimensioni devono inoltre essere uguali se uno qualsiasi degli oggetti framebuffer è un framebuffer multisample.

Nota: se abilitato,il test «scissor» limiterà l’area di blit.

Quando sono in uso più destinazioni di rendering, ` readColorAttachmentIndex ` e ` drawColorAttachmentIndex ` specificano l’indice degli allegati di colore nei framebuffer di origine e di destinazione.

restorePolicy determina se il framebuffer associato prima della chiamata a questa funzione debba essere ripristinato, se debba essere associato il framebuffer predefinito prima del ritorno, oppure se spetti al chiamante il compito di tenere traccia e impostare il framebuffer associato. Il ripristino del framebuffer precedente può risultare relativamente oneroso a causa della chiamata a ` glGetIntegerv `, che su alcuni driver OpenGL può comportare un blocco della pipeline.

Vedi anche ` hasOpenGLFramebufferBlit()`.

[static] void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, QOpenGLFramebufferObject *source, GLbitfield buffers = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST)

Sovraccarico di convenienza per il blit tra due oggetti framebuffer.

Si tratta di una funzione sovraccaricata.

[static] void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers = GL_COLOR_BUFFER_BIT, GLenum filter = GL_NEAREST)

* Sovraccarico di convenienza per il blit tra due oggetti framebuffer.

Si tratta di una funzione sovraccaricata.

[static] void QOpenGLFramebufferObject::blitFramebuffer(QOpenGLFramebufferObject *target, const QRect &targetRect, QOpenGLFramebufferObject *source, const QRect &sourceRect, GLbitfield buffers, GLenum filter, int readColorAttachmentIndex, int drawColorAttachmentIndex)

Funzione di convenienza per eseguire un blit tra due oggetti framebuffer e ripristinare il precedente binding del framebuffer. Equivalente alla chiamata a blitFramebuffer(target, targetRect, source, sourceRect, buffers, filter, readColorAttachmentIndex, drawColorAttachmentIndex, RestoreFrameBufferBinding).

Si tratta di una funzione sovraccaricata.

QOpenGLFramebufferObjectFormat QOpenGLFramebufferObject::format() const

Restituisce il formato di questo oggetto framebuffer.

GLuint QOpenGLFramebufferObject::handle() const

Restituisce l'handle dell'oggetto framebuffer OpenGL corrispondente a questo oggetto framebuffer (restituito dalla funzione ` glGenFrameBuffersEXT() `). Questo handle può essere utilizzato per associare nuove immagini o buffer al framebuffer. L'utente è responsabile della pulizia e della distruzione di questi oggetti.

[static] bool QOpenGLFramebufferObject::hasOpenGLFramebufferBlit()

Restituisce ` true ` se sul sistema è presente l'estensione OpenGL ` GL_EXT_framebuffer_blit `; in caso contrario, restituisce ` false`.

Vedi anche blitFramebuffer().

[static] bool QOpenGLFramebufferObject::hasOpenGLFramebufferObjects()

Restituisce ` true ` se sul sistema è presente l'estensione OpenGL ` GL_EXT_framebuffer_object `; in caso contrario, restituisce ` false`.

int QOpenGLFramebufferObject::height() const

Restituisce l'altezza degli oggetti collegati al framebuffer.

bool QOpenGLFramebufferObject::isBound() const

Restituisce ` true ` se l'oggetto framebuffer è attualmente associato al contesto corrente; in caso contrario, restituisce `false`.

bool QOpenGLFramebufferObject::isValid() const

Restituisce true se l'oggetto framebuffer è valido.

Il framebuffer può diventare non valido se il processo di inizializzazione fallisce, se l'utente associa un buffer non valido all'oggetto framebuffer, oppure se come dimensione della texture viene specificata una larghezza/altezza non potenza di due nel caso in cui la destinazione della texture sia GL_TEXTURE_2D. La limitazione relativa alle dimensioni non potenze di due non si applica se la versione di OpenGL è 2.0 o superiore, oppure se è presente l’estensione GL_ARB_texture_non_power_of_two.

Il framebuffer può inoltre diventare non valido se l’ QOpenGLContext in cui è stato creato viene distrutto e non vi sono altri contesti condivisi in grado di assumerne la proprietà.

bool QOpenGLFramebufferObject::release()

Ripristina le impostazioni predefinite, utilizzando il framebuffer fornito dal sistema a finestre. Restituisce true in caso di esito positivo, false in caso contrario.

Vedi anche bind().

void QOpenGLFramebufferObject::setAttachment(QOpenGLFramebufferObject::Attachment attachment)

Imposta gli allegati dell'oggetto framebuffer su attachment.

Questa funzione può essere utilizzata per liberare o ricollegare gli allegati del buffer di profondità e dello stencil, a seconda delle necessità.

Nota: questa funzione modifica il binding corrente del framebuffer.

Vedi anche attachment().

QSize QOpenGLFramebufferObject::size() const

Restituisce la dimensione degli allegati di colore e profondità/stencil associati a questo oggetto framebuffer.

QList<QSize> QOpenGLFramebufferObject::sizes() const

Restituisce le dimensioni di tutti gli allegati di colore associati a questo oggetto framebuffer.

GLuint QOpenGLFramebufferObject::takeTexture()

Restituisce l'ID della texture associata a questo oggetto framebuffer. La proprietà della texture viene trasferita al chiamante.

Se l'oggetto framebuffer è attualmente associato, verrà eseguita implicitamente la chiamata a ` release()`. Durante la successiva chiamata a ` bind()`, verrà creata una nuova texture.

Se si utilizza un oggetto framebuffer multisample, non è presente alcuna texture e il valore restituito da questa funzione non sarà valido. Analogamente, anche gli oggetti framebuffer incompleti restituiranno 0.

Vedi anche texture(), bind() e release().

GLuint QOpenGLFramebufferObject::takeTexture(int colorAttachmentIndex)

Restituisce l'ID della texture associata all'attaccamento di colore con indice colorAttachmentIndex di questo oggetto framebuffer. La proprietà della texture viene trasferita al chiamante.

Quando colorAttachmentIndex è 0, il comportamento è identico alla variante senza parametri di questa funzione.

Se l’oggetto framebuffer è attualmente associato, verrà eseguito implicitamente un release(). Durante la successiva chiamata a bind() verrà creata una nuova texture.

Se si utilizza un oggetto framebuffer multisample, non è presente alcuna texture e il valore restituito da questa funzione sarà non valido. Analogamente, anche gli oggetti framebuffer incompleti restituiranno 0.

Si tratta di una funzione sovraccaricata.

GLuint QOpenGLFramebufferObject::texture() const

Restituisce l'ID della texture associata come destinazione di rendering predefinita in questo oggetto framebuffer. Questo ID di texture può essere associato come una normale texture nel proprio codice OpenGL.

Se si utilizza un oggetto framebuffer multisample, il valore restituito da questa funzione non sarà valido.

Quando sono associate più texture, il valore restituito è l’ID della prima.

Vedi anche takeTexture() e textures().

QList<GLuint> QOpenGLFramebufferObject::textures() const

Restituisce l'ID di tutte le texture associate.

Se viene utilizzato un oggetto framebuffer multisample, viene restituito un vettore vuoto.

Vedi anche takeTexture() e texture().

QImage QOpenGLFramebufferObject::toImage(bool flipped = true) const

Restituisce il contenuto di questo oggetto framebuffer come oggetto ` QImage`.

Se ` flipped ` è vero, l’immagine viene convertita dalle coordinate OpenGL alle coordinate raster. Se utilizzato insieme a ` QOpenGLPaintDevice`, ` flipped ` deve essere il valore opposto a quello restituito da ` QOpenGLPaintDevice::paintFlipped()`.

L'immagine restituita ha un formato ARGB32 o RGB32 premoltiplicato. Quest'ultimo viene utilizzato solo quando `internalTextureFormat()` è impostato su ` GL_RGB`. A partire da Qt 5.2, la funzione ricorrerà a RGBA8888 o RGBx8888 premoltiplicati qualora la lettura in (A)RGB32 non sia supportata, e ciò include OpenGL ES. A partire da Qt 5.4 viene restituita un’immagine A2BGR30 se il formato interno è RGB10_A2, mentre a partire da Qt 5.12 viene restituita un’immagine RGBA64 se il formato interno è RGBA16.

Se il rendering nel framebuffer non è stato effettuato tenendo conto dell’alfa premoltiplicato, creare un wrapper QImage con un formato non premoltiplicato. Ciò è necessario prima di eseguire operazioni come QImage::save(), poiché altrimenti i dati dell’immagine verrebbero depremoltiplicati, anche se in origine non erano premoltiplicati. Per creare un wrapper di questo tipo senza eseguire una copia dei dati dei pixel, procedere come segue:

QImage fboImage(fbo.toImage());
QImage image(fboImage.constBits(), fboImage.width(), fboImage.height(), QImage::Format_ARGB32);

Per gli oggetti framebuffer multisampionati, i campioni vengono risolti utilizzando l’estensione GL_EXT_framebuffer_blit. Se l’estensione non è disponibile, il contenuto dell’immagine restituita è indefinito.

Per i framebuffer a campionamento singolo, il contenuto viene recuperato tramite ` glReadPixels`. Si tratta di un'operazione potenzialmente onerosa e inefficiente. Si raccomanda pertanto di utilizzare questa funzione il meno possibile.

Vedi anche ` QOpenGLPaintDevice::paintFlipped()`.

QImage QOpenGLFramebufferObject::toImage(bool flipped, int colorAttachmentIndex) const

Restituisce il contenuto dell'attaccamento colore all'indice colorAttachmentIndex di questo oggetto framebuffer come oggetto ` QImage`. Questo metodo converte l'immagine dalle coordinate OpenGL alle coordinate raster quando ` flipped ` è impostato su ` true`.

Nota: questo sovraccarico è pienamente funzionante solo quando l’implementazione OpenGL supporta più destinazioni di rendering. In caso contrario, verrà configurato un solo allegato di colore.

Si tratta di una funzione sovraccaricata.

int QOpenGLFramebufferObject::width() const

Restituisce la larghezza degli allegati dell'oggetto framebuffer.

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.