Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QGLFormat Class Reference

Inherited by QGLDefaultOverlayFormat.

List of all members.

Detailed Description

The QGLFormat class specifies the display format of an OpenGL rendering context.

A display format has several characteristics: Double or single buffering. Depth buffer. RGBA or color index mode. Alpha channel. Accumulation buffer. Stencil buffer. Stereo buffers. Direct rendering. Presence of an overlay. The plane of an overlay format. Multisample buffers.

You can also specify preferred bit depths for the depth buffer, alpha buffer, accumulation buffer and the stencil buffer with the functions: setDepthBufferSize(), setAlphaBufferSize(), setAccumBufferSize() and setStencilBufferSize().

Note that even if you specify that you prefer a 32 bit depth buffer (e.g. with setDepthBufferSize(32)), the format that is chosen may not have a 32 bit depth buffer, even if there is a format available with a 32 bit depth buffer. The main reason for this is how the system dependant picking algorithms work on the different platforms, and some format options may have higher precedence than others.

You create and tell a QGLFormat object what rendering options you want from an OpenGL rendering context.

OpenGL drivers or accelerated hardware may or may not support advanced features such as alpha channel or stereographic viewing. If you request some features that the driver/hardware does not provide when you create a QGLWidget, you will get a rendering context with the nearest subset of features.

There are different ways to define the display characteristics of a rendering context. One is to create a QGLFormat and make it the default for the entire application: doc/src/snippets/code/src_opengl_qgl.cpp 0

Or you can specify the desired format when creating an object of your QGLWidget subclass: doc/src/snippets/code/src_opengl_qgl.cpp 1

After the widget has been created, you can find out which of the requested features the system was able to provide: doc/src/snippets/code/src_opengl_qgl.cpp 2

OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other countries.

See also:
QGLContext, QGLWidget

Definition at line 154 of file qgl.h.

Public Types

enum  OpenGLVersionFlag {
  OpenGL_Version_None = 0x00000000, OpenGL_Version_1_1 = 0x00000001, OpenGL_Version_1_2 = 0x00000002, OpenGL_Version_1_3 = 0x00000004,
  OpenGL_Version_1_4 = 0x00000008, OpenGL_Version_1_5 = 0x00000010, OpenGL_Version_2_0 = 0x00000020, OpenGL_Version_2_1 = 0x00000040,
  OpenGL_ES_Common_Version_1_0 = 0x00000080, OpenGL_ES_CommonLite_Version_1_0 = 0x00000100, OpenGL_ES_Common_Version_1_1 = 0x00000200, OpenGL_ES_CommonLite_Version_1_1 = 0x00000400,
  OpenGL_ES_Version_2_0 = 0x00000800

Public Member Functions

bool accum () const
int accumBufferSize () const
bool alpha () const
int alphaBufferSize () const
int blueBufferSize () const
bool depth () const
int depthBufferSize () const
bool directRendering () const
bool doubleBuffer () const
int greenBufferSize () const
bool hasOverlay () const
QGLFormatoperator= (const QGLFormat &other)
int plane () const
 QGLFormat (const QGLFormat &other)
 QGLFormat (QGL::FormatOptions options, int plane=0)
 QGLFormat ()
int redBufferSize () const
bool rgba () const
bool sampleBuffers () const
int samples () const
void setAccum (bool enable)
void setAccumBufferSize (int size)
void setAlpha (bool enable)
void setAlphaBufferSize (int size)
void setBlueBufferSize (int size)
void setDepth (bool enable)
void setDepthBufferSize (int size)
void setDirectRendering (bool enable)
void setDoubleBuffer (bool enable)
void setGreenBufferSize (int size)
void setOption (QGL::FormatOptions opt)
void setOverlay (bool enable)
void setPlane (int plane)
void setRedBufferSize (int size)
void setRgba (bool enable)
void setSampleBuffers (bool enable)
void setSamples (int numSamples)
void setStencil (bool enable)
void setStencilBufferSize (int size)
void setStereo (bool enable)
void setSwapInterval (int interval)
bool stencil () const
int stencilBufferSize () const
bool stereo () const
int swapInterval () const
bool testOption (QGL::FormatOptions opt) const
 ~QGLFormat ()

Static Public Member Functions

static QGLFormat defaultFormat ()
static QGLFormat defaultOverlayFormat ()
static bool hasOpenGL ()
static bool hasOpenGLOverlays ()
static OpenGLVersionFlags openGLVersionFlags ()
static void setDefaultFormat (const QGLFormat &f)
static void setDefaultOverlayFormat (const QGLFormat &f)

Private Attributes

QGLFormatPrivate * d


Q_OPENGL_EXPORT bool operator!= (const QGLFormat &, const QGLFormat &)
Q_OPENGL_EXPORT bool operator== (const QGLFormat &, const QGLFormat &)

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

Generated by  Doxygen 1.6.0   Back to index