Eneboo - Documentación para desarrolladores
Clases | Métodos públicos | Métodos públicos estáticos | Métodos protegidos | Atributos protegidos | Atributos protegidos estáticos | Amigas
Referencia de la Clase QGLContext

The QGLContext class encapsulates an OpenGL rendering context.OpenGL. Más...

#include <qgl.h>

Diagrama de herencias de QGLContext
QGL QGL

Lista de todos los miembros.

Clases

class  Private

Métodos públicos

 QGLContext (const QGLFormat &format, QPaintDevice *device)
 QGLContext (const QGLFormat &format)
virtual ~QGLContext ()
virtual bool create (const QGLContext *shareContext=0)
bool isValid () const
bool isSharing () const
virtual void reset ()
QGLFormat format () const
QGLFormat requestedFormat () const
virtual void setFormat (const QGLFormat &format)
virtual void makeCurrent ()
virtual void swapBuffers () const
QPaintDevicedevice () const
QColor overlayTransparentColor () const
 QGLContext (const QGLFormat &format, QPaintDevice *device)
 QGLContext (const QGLFormat &format)
virtual ~QGLContext ()
virtual bool create (const QGLContext *shareContext=0)
bool isValid () const
bool isSharing () const
virtual void reset ()
QGLFormat format () const
QGLFormat requestedFormat () const
virtual void setFormat (const QGLFormat &format)
virtual void makeCurrent ()
virtual void swapBuffers () const
QPaintDevicedevice () const
QColor overlayTransparentColor () const

Métodos públicos estáticos

static const QGLContextcurrentContext ()
static const QGLContextcurrentContext ()

Métodos protegidos

virtual bool chooseContext (const QGLContext *shareContext=0)
virtual void doneCurrent ()
bool deviceIsPixmap () const
bool windowCreated () const
void setWindowCreated (bool on)
bool initialized () const
void setInitialized (bool on)
void generateFontDisplayLists (const QFont &fnt, int listBase)
uint colorIndex (const QColor &c) const
void setValid (bool valid)
void setDevice (QPaintDevice *pDev)
virtual bool chooseContext (const QGLContext *shareContext=0)
virtual void doneCurrent ()
bool deviceIsPixmap () const
bool windowCreated () const
void setWindowCreated (bool on)
bool initialized () const
void setInitialized (bool on)
void generateFontDisplayLists (const QFont &fnt, int listBase)
uint colorIndex (const QColor &c) const
void setValid (bool valid)
void setDevice (QPaintDevice *pDev)

Atributos protegidos

QGLFormat glFormat
QGLFormat reqFormat

Atributos protegidos estáticos

static QGLContextcurrentCtx = 0

Amigas

class QGLWidget

Descripción detallada

The QGLContext class encapsulates an OpenGL rendering context.

OpenGL.

An OpenGL* rendering context is a complete set of OpenGL state variables.

The context's format is set in the constructor or later with setFormat(). The format options that are actually set are returned by format(); the options you asked for are returned by requestedFormat(). Note that after a QGLContext object has been constructed, the actual OpenGL context must be created by explicitly calling the create() function. The makeCurrent() function makes this context the current rendering context. You can make no context current using doneCurrent(). The reset() function will reset the context and make it invalid.

You can examine properties of the context with, e.g. isValid(), isSharing(), initialized(), windowCreated() and overlayTransparentColor().

If you're using double buffering you can swap the screen contents with the off-screen buffer using swapBuffers().

Please note that QGLContext is not thread safe.

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


Documentación del constructor y destructor

QGLContext::QGLContext ( const QGLFormat format,
QPaintDevice device 
)

Constructs an OpenGL context for the paint device device, which can be a widget or a pixmap. The format specifies several display options for the context.

If the underlying OpenGL/Window system cannot satisfy all the features requested in format, the nearest subset of features will be used. After creation, the format() method will return the actual format obtained.

Note that after a QGLContext object has been constructed, create() must be called explicitly to create the actual OpenGL context. The context will be invalid if it was not possible to obtain a GL context at all.

Ver también:
format(), isValid()
QGLContext::QGLContext ( const QGLFormat format)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

QGLContext::~QGLContext ( ) [virtual]

Destroys the OpenGL context and frees its resources.

QGLContext::QGLContext ( const QGLFormat format,
QPaintDevice device 
)
QGLContext::QGLContext ( const QGLFormat format)
virtual QGLContext::~QGLContext ( ) [virtual]

Documentación de las funciones miembro

bool QGLContext::chooseContext ( const QGLContext shareContext = 0) [protected, virtual]

This semi-internal function is called by create(). It creates a system-dependent OpenGL handle that matches the format() of shareContext as closely as possible.

On Windows, it calls the virtual function choosePixelFormat(), which finds a matching pixel format identifier. On X11, it calls the virtual function chooseVisual() which finds an appropriate X visual. On other platforms it may work differently.

virtual bool QGLContext::chooseContext ( const QGLContext shareContext = 0) [protected, virtual]
uint QGLContext::colorIndex ( const QColor c) const [protected]
uint QGLContext::colorIndex ( const QColor c) const [protected]
bool QGLContext::create ( const QGLContext shareContext = 0) [virtual]

Creates the GL context. Returns TRUE if it was successful in creating a valid GL rendering context on the paint device specified in the constructor; otherwise returns FALSE (i.e. the context is invalid).

After successful creation, format() returns the set of features of the created GL rendering context.

If shareContext points to a valid QGLContext, this method will try to establish OpenGL display list sharing between this context and the shareContext. Note that this may fail if the two contexts have different formats. Use isSharing() to see if sharing succeeded.

Atención:
Implementation note: initialization of C++ class members usually takes place in the class constructor. QGLContext is an exception because it must be simple to customize. The virtual functions chooseContext() (and chooseVisual() for X11) can be reimplemented in a subclass to select a particular context. The problem is that virtual functions are not properly called during construction (even though this is correct C++) because C++ constructs class hierarchies from the bottom up. For this reason we need a create() function.
Ver también:
chooseContext(), format(), isValid()
virtual bool QGLContext::create ( const QGLContext shareContext = 0) [virtual]
static const QGLContext* QGLContext::currentContext ( ) [static]
const QGLContext * QGLContext::currentContext ( ) [inline, static]

Returns the current context, i.e. the context to which any OpenGL commands will currently be directed. Returns 0 if no context is current.

Ver también:
makeCurrent()
QPaintDevice* QGLContext::device ( ) const
QPaintDevice * QGLContext::device ( ) const [inline]

Returns the paint device set for this context.

Ver también:
QGLContext::QGLContext()
bool QGLContext::deviceIsPixmap ( ) const [protected]
bool QGLContext::deviceIsPixmap ( ) const [inline, protected]

Returns TRUE if the paint device of this context is a pixmap; otherwise returns FALSE.

virtual void QGLContext::doneCurrent ( ) [protected, virtual]
void QGLContext::doneCurrent ( ) [protected, virtual]

Makes no GL context the current context. Normally, you do not need to call this function; QGLContext calls it as necessary.

QGLFormat QGLContext::format ( ) const [inline]

Returns the frame buffer format that was obtained (this may be a subset of what was requested).

Ver también:
requestedFormat()
QGLFormat QGLContext::format ( ) const
void QGLContext::generateFontDisplayLists ( const QFont font,
int  listBase 
) [protected]

Generates a set of 256 display lists for the 256 first characters in the font font. The first list will start at index listBase.

Ver también:
QGLWidget::renderText()
void QGLContext::generateFontDisplayLists ( const QFont fnt,
int  listBase 
) [protected]
bool QGLContext::initialized ( ) const [inline, protected]

Returns TRUE if this context has been initialized, i.e. if QGLWidget::initializeGL() has been performed on it; otherwise returns FALSE.

Ver también:
setInitialized()
bool QGLContext::initialized ( ) const [protected]
bool QGLContext::isSharing ( ) const [inline]

Returns TRUE if display list sharing with another context was requested in the create() call and the GL system was able to fulfill this request; otherwise returns FALSE. Note that display list sharing might not be supported between contexts with different formats.

bool QGLContext::isSharing ( ) const
bool QGLContext::isValid ( void  ) const [inline]

Returns TRUE if a GL rendering context has been successfully created; otherwise returns FALSE.

bool QGLContext::isValid ( ) const
void QGLContext::makeCurrent ( ) [virtual]

Makes this context the current OpenGL rendering context. All GL functions you call operate on this context until another context is made current.

In some very rare cases the underlying call may fail. If this occurs an error message is output to stderr.

virtual void QGLContext::makeCurrent ( ) [virtual]
QColor QGLContext::overlayTransparentColor ( ) const
QColor QGLContext::overlayTransparentColor ( ) const

If this context is a valid context in an overlay plane, returns the plane's transparent color. Otherwise returns an invalid color.

The returned color's pixel value is the index of the transparent color in the colormap of the overlay plane. (Naturally, the color's RGB values are meaningless.)

The returned QColor object will generally work as expected only when passed as the argument to QGLWidget::qglColor() or QGLWidget::qglClearColor(). Under certain circumstances it can also be used to draw transparent graphics with a QPainter. See the examples/opengl/overlay_x11 example for details.

QGLFormat QGLContext::requestedFormat ( ) const [inline]

Returns the frame buffer format that was originally requested in the constructor or setFormat().

Ver también:
format()
QGLFormat QGLContext::requestedFormat ( ) const
void QGLContext::reset ( void  ) [virtual]

Resets the context and makes it invalid.

Ver también:
create(), isValid()
virtual void QGLContext::reset ( ) [virtual]
void QGLContext::setDevice ( QPaintDevice pDev) [protected]
void QGLContext::setDevice ( QPaintDevice pDev) [protected]
void QGLContext::setFormat ( const QGLFormat format) [virtual]

Sets a format for this context. The context is reset.

Call create() to create a new GL context that tries to match the new format.

    QGLContext *cx;
    //  ...
    QGLFormat f;
    f.setStereo( TRUE );
    cx->setFormat( f );
    if ( !cx->create() )
        exit(); // no OpenGL support, or cannot render on the specified paintdevice
    if ( !cx->format().stereo() )
        exit(); // could not create stereo context
Ver también:
format(), reset(), create()
virtual void QGLContext::setFormat ( const QGLFormat format) [virtual]
void QGLContext::setInitialized ( bool  on) [inline, protected]

If on is TRUE the context has been initialized, i.e. QGLContext::setInitialized() has been called on it. If on is FALSE the context has not been initialized.

Ver también:
initialized()
void QGLContext::setInitialized ( bool  on) [protected]
void QGLContext::setValid ( bool  valid) [protected]
void QGLContext::setValid ( bool  valid) [inline, protected]
void QGLContext::setWindowCreated ( bool  on) [inline, protected]

If on is TRUE the context has had a window created for it. If on is FALSE no window has been created for the context.

Ver también:
windowCreated()
void QGLContext::setWindowCreated ( bool  on) [protected]
void QGLContext::swapBuffers ( ) const [virtual]

Swaps the screen contents with an off-screen buffer. Only works if the context is in double buffer mode.

Ver también:
QGLFormat::setDoubleBuffer()
virtual void QGLContext::swapBuffers ( ) const [virtual]
bool QGLContext::windowCreated ( ) const [inline, protected]

Returns TRUE if a window has been created for this context; otherwise returns FALSE.

Ver también:
setWindowCreated()
bool QGLContext::windowCreated ( ) const [protected]

Documentación de las funciones relacionadas y clases amigas

QGLWidget [friend]

Documentación de los datos miembro

static QGLContext * QGLContext::currentCtx = 0 [static, protected]

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'