Qt 4.8
Public Functions | Private Functions | Properties | List of all members
QGLFramebufferObjectFormat Class Reference

The QGLFramebufferObjectFormat class specifies the format of an OpenGL framebuffer object. More...

#include <qglframebufferobject.h>

Public Functions

QGLFramebufferObject::Attachment attachment () const
 Returns the configuration of the depth and stencil buffers attached to a framebuffer object. More...
 
GLenum internalTextureFormat () const
 Returns the internal format of a framebuffer object's texture or multisample framebuffer object's color buffer. More...
 
bool mipmap () const
 Returns true if mipmapping is enabled. More...
 
bool operator!= (const QGLFramebufferObjectFormat &other) const
 Returns false if all the options of this framebuffer object format are the same as other; otherwise returns true. More...
 
QGLFramebufferObjectFormatoperator= (const QGLFramebufferObjectFormat &other)
 Assigns other to this object. More...
 
bool operator== (const QGLFramebufferObjectFormat &other) const
 Returns true if all the options of this framebuffer object format are the same as other; otherwise returns false. More...
 
 QGLFramebufferObjectFormat ()
 Creates a QGLFramebufferObjectFormat object for specifying the format of an OpenGL framebuffer object. More...
 
 QGLFramebufferObjectFormat (const QGLFramebufferObjectFormat &other)
 Constructs a copy of other. More...
 
int samples () const
 Returns the number of samples per pixel if a framebuffer object is a multisample framebuffer object. More...
 
void setAttachment (QGLFramebufferObject::Attachment attachment)
 Sets the attachment configuration of a framebuffer object to attachment. More...
 
void setInternalTextureFormat (GLenum internalTextureFormat)
 Sets the internal format of a framebuffer object's texture or multisample framebuffer object's color buffer to internalTextureFormat. More...
 
void setMipmap (bool enabled)
 Enables mipmapping if enabled is true; otherwise disables it. More...
 
void setSamples (int samples)
 Sets the number of samples per pixel for a multisample framebuffer object to samples. More...
 
void setTextureTarget (GLenum target)
 Sets the texture target of the texture attached to a framebuffer object to target. More...
 
GLenum textureTarget () const
 Returns the texture target of the texture attached to a framebuffer object. More...
 
 ~QGLFramebufferObjectFormat ()
 Destroys the QGLFramebufferObjectFormat. More...
 

Private Functions

void detach ()
 

Properties

QGLFramebufferObjectFormatPrivated
 

Detailed Description

The QGLFramebufferObjectFormat class specifies the format of an OpenGL framebuffer object.

Since
4.6

A framebuffer object has several characteristics:

Note that the desired attachments or number of samples per pixels might not be supported by the hardware driver. Call QGLFramebufferObject::format() after creating a QGLFramebufferObject to find the exact format that was used to create the frame buffer object.

See also
QGLFramebufferObject

Definition at line 140 of file qglframebufferobject.h.

Constructors and Destructors

◆ QGLFramebufferObjectFormat() [1/2]

QGLFramebufferObjectFormat::QGLFramebufferObjectFormat ( )

Creates a QGLFramebufferObjectFormat object for specifying the format of an OpenGL framebuffer object.

By default the format specifies a non-multisample framebuffer object with no attachments, texture target GL_TEXTURE_2D, and internal format GL_RGBA8. On OpenGL/ES systems, the default internal format is GL_RGBA.

See also
samples(), attachment(), internalTextureFormat()

Definition at line 138 of file qglframebufferobject.cpp.

◆ QGLFramebufferObjectFormat() [2/2]

QGLFramebufferObjectFormat::QGLFramebufferObjectFormat ( const QGLFramebufferObjectFormat other)

Constructs a copy of other.

Definition at line 147 of file qglframebufferobject.cpp.

148 {
149  d = other.d;
150  d->ref.ref();
151 }
bool ref()
Atomically increments the value of this QAtomicInt.
QGLFramebufferObjectFormatPrivate * d

◆ ~QGLFramebufferObjectFormat()

QGLFramebufferObjectFormat::~QGLFramebufferObjectFormat ( )

Destroys the QGLFramebufferObjectFormat.

Definition at line 171 of file qglframebufferobject.cpp.

172 {
173  if (!d->ref.deref())
174  delete d;
175 }
bool deref()
Atomically decrements the value of this QAtomicInt.
QGLFramebufferObjectFormatPrivate * d

Functions

◆ attachment()

QGLFramebufferObject::Attachment QGLFramebufferObjectFormat::attachment ( ) const

Returns the configuration of the depth and stencil buffers attached to a framebuffer object.

The default is QGLFramebufferObject::NoAttachment.

See also
setAttachment()

Definition at line 263 of file qglframebufferobject.cpp.

Referenced by QGLFramebufferObject::QGLFramebufferObject(), and setAttachment().

264 {
265  return d->attachment;
266 }
QGLFramebufferObject::Attachment attachment
QGLFramebufferObjectFormatPrivate * d

◆ detach()

void QGLFramebufferObjectFormat::detach ( )
private
Warning
This function is not part of the public interface.

Definition at line 116 of file qglframebufferobject.cpp.

Referenced by internalTextureFormat(), setAttachment(), setInternalTextureFormat(), setMipmap(), setSamples(), and setTextureTarget().

117 {
118  if (d->ref != 1) {
121  if (!d->ref.deref())
122  delete d;
123  d = newd;
124  }
125 }
bool deref()
Atomically decrements the value of this QAtomicInt.
QGLFramebufferObjectFormatPrivate * d

◆ internalTextureFormat()

GLenum QGLFramebufferObjectFormat::internalTextureFormat ( ) const

Returns the internal format of a framebuffer object's texture or multisample framebuffer object's color buffer.

The default is GL_RGBA8 on desktop OpenGL systems, and GL_RGBA on OpenGL/ES systems.

See also
setInternalTextureFormat()

Definition at line 313 of file qglframebufferobject.cpp.

Referenced by QGLFramebufferObject::QGLFramebufferObject(), QGLFBOGLPaintDevice::setFBO(), setInternalTextureFormat(), and ShaderEffectSource::updateBackbuffer().

314 {
315  return d->internal_format;
316 }
QGLFramebufferObjectFormatPrivate * d

◆ mipmap()

bool QGLFramebufferObjectFormat::mipmap ( ) const

Returns true if mipmapping is enabled.

Since
4.8
See also
setMipmap()

Definition at line 241 of file qglframebufferobject.cpp.

Referenced by QGLFramebufferObject::QGLFramebufferObject().

242 {
243  return d->mipmap;
244 }
QGLFramebufferObjectFormatPrivate * d

◆ operator!=()

bool QGLFramebufferObjectFormat::operator!= ( const QGLFramebufferObjectFormat other) const

Returns false if all the options of this framebuffer object format are the same as other; otherwise returns true.

Definition at line 350 of file qglframebufferobject.cpp.

351 {
352  return !(*this == other);
353 }

◆ operator=()

QGLFramebufferObjectFormat & QGLFramebufferObjectFormat::operator= ( const QGLFramebufferObjectFormat other)

Assigns other to this object.

Definition at line 157 of file qglframebufferobject.cpp.

158 {
159  if (d != other.d) {
160  other.d->ref.ref();
161  if (!d->ref.deref())
162  delete d;
163  d = other.d;
164  }
165  return *this;
166 }
bool ref()
Atomically increments the value of this QAtomicInt.
bool deref()
Atomically decrements the value of this QAtomicInt.
QGLFramebufferObjectFormatPrivate * d

◆ operator==()

bool QGLFramebufferObjectFormat::operator== ( const QGLFramebufferObjectFormat other) const

Returns true if all the options of this framebuffer object format are the same as other; otherwise returns false.

Definition at line 338 of file qglframebufferobject.cpp.

339 {
340  if (d == other.d)
341  return true;
342  else
343  return d->equals(other.d);
344 }
bool equals(const QGLFramebufferObjectFormatPrivate *other)
QGLFramebufferObjectFormatPrivate * d

◆ samples()

int QGLFramebufferObjectFormat::samples ( ) const

Returns the number of samples per pixel if a framebuffer object is a multisample framebuffer object.

Otherwise, returns 0. The default value is 0.

See also
setSamples()

Definition at line 203 of file qglframebufferobject.cpp.

Referenced by QGLWindowSurface::flush(), QGLFramebufferObject::QGLFramebufferObject(), setSamples(), and QGLWindowSurface::updateGeometry().

204 {
205  return d->samples;
206 }
QGLFramebufferObjectFormatPrivate * d

◆ setAttachment()

void QGLFramebufferObjectFormat::setAttachment ( QGLFramebufferObject::Attachment  attachment)

Sets the attachment configuration of a framebuffer object to attachment.

See also
attachment()

Definition at line 251 of file qglframebufferobject.cpp.

Referenced by QGLPixmapData::paintEngine(), ShaderEffectSource::updateBackbuffer(), and QGLWindowSurface::updateGeometry().

252 {
253  detach();
255 }
QGLFramebufferObject::Attachment attachment
QGLFramebufferObject::Attachment attachment() const
Returns the configuration of the depth and stencil buffers attached to a framebuffer object...
QGLFramebufferObjectFormatPrivate * d

◆ setInternalTextureFormat()

void QGLFramebufferObjectFormat::setInternalTextureFormat ( GLenum  internalTextureFormat)

Sets the internal format of a framebuffer object's texture or multisample framebuffer object's color buffer to internalTextureFormat.

See also
internalTextureFormat()

Definition at line 299 of file qglframebufferobject.cpp.

Referenced by internalTextureFormat(), QGLPixmapData::paintEngine(), ShaderEffectSource::updateBackbuffer(), and QGLWindowSurface::updateGeometry().

300 {
301  detach();
303 }
GLenum internalTextureFormat() const
Returns the internal format of a framebuffer object&#39;s texture or multisample framebuffer object&#39;s col...
QGLFramebufferObjectFormatPrivate * d

◆ setMipmap()

void QGLFramebufferObjectFormat::setMipmap ( bool  enabled)

Enables mipmapping if enabled is true; otherwise disables it.

Since
4.8

Mipmapping is disabled by default.

If mipmapping is enabled, additional memory will be allocated for the mipmap levels. The mipmap levels can be updated by binding the texture and calling glGenerateMipmap(). Mipmapping cannot be enabled for multisampled framebuffer objects.

See also
mipmap(), QGLFramebufferObject::texture()

Definition at line 225 of file qglframebufferobject.cpp.

226 {
227  detach();
228  d->mipmap = enabled;
229 }
QGLFramebufferObjectFormatPrivate * d
#define enabled

◆ setSamples()

void QGLFramebufferObjectFormat::setSamples ( int  samples)

Sets the number of samples per pixel for a multisample framebuffer object to samples.

The default sample count of 0 represents a regular non-multisample framebuffer object.

If the desired amount of samples per pixel is not supported by the hardware then the maximum number of samples per pixel will be used. Note that multisample framebuffer objects can not be bound as textures. Also, the GL_EXT_framebuffer_multisample extension is required to create a framebuffer with more than one sample per pixel.

See also
samples()

Definition at line 190 of file qglframebufferobject.cpp.

Referenced by QGLPixmapData::paintEngine(), and QGLWindowSurface::updateGeometry().

191 {
192  detach();
193  d->samples = samples;
194 }
int samples() const
Returns the number of samples per pixel if a framebuffer object is a multisample framebuffer object...
QGLFramebufferObjectFormatPrivate * d

◆ setTextureTarget()

void QGLFramebufferObjectFormat::setTextureTarget ( GLenum  target)

Sets the texture target of the texture attached to a framebuffer object to target.

Ignored for multisample framebuffer objects.

See also
textureTarget(), samples()

Definition at line 274 of file qglframebufferobject.cpp.

Referenced by internalTextureFormat(), and QGLWindowSurface::updateGeometry().

275 {
276  detach();
277  d->target = target;
278 }
QGLFramebufferObjectFormatPrivate * d

◆ textureTarget()

GLenum QGLFramebufferObjectFormat::textureTarget ( ) const

Returns the texture target of the texture attached to a framebuffer object.

Ignored for multisample framebuffer objects. The default is GL_TEXTURE_2D.

See also
setTextureTarget(), samples()

Definition at line 287 of file qglframebufferobject.cpp.

Referenced by QGLFramebufferObject::QGLFramebufferObject().

288 {
289  return d->target;
290 }
QGLFramebufferObjectFormatPrivate * d

Properties

◆ d

QGLFramebufferObjectFormatPrivate* QGLFramebufferObjectFormat::d
private

The documentation for this class was generated from the following files: