Eneboo - Documentación para desarrolladores
Slots públicos | Métodos públicos | Métodos públicos estáticos | Métodos protegidos
Referencia de la Clase QGLWidget

The QGLWidget class is a widget for rendering OpenGL graphics.OpenGL. Más...

#include <qgl.h>

Diagrama de herencias de QGLWidget
QWidget QGL QWidget QGL QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject

Lista de todos los miembros.

Slots públicos

virtual void updateGL ()
virtual void updateOverlayGL ()
virtual void updateGL ()
virtual void updateOverlayGL ()

Métodos públicos

 QGLWidget (QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0)
 QGLWidget (QGLContext *context, QWidget *parent, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0)
 QGLWidget (const QGLFormat &format, QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0)
 ~QGLWidget ()
void qglColor (const QColor &c) const
void qglClearColor (const QColor &c) const
bool isValid () const
bool isSharing () const
virtual void makeCurrent ()
void doneCurrent ()
bool doubleBuffer () const
virtual void swapBuffers ()
QGLFormat format () const
virtual void setFormat (const QGLFormat &format)
const QGLContextcontext () const
virtual void setContext (QGLContext *context, const QGLContext *shareContext=0, bool deleteOldContext=TRUE)
virtual QPixmap renderPixmap (int w=0, int h=0, bool useContext=FALSE)
virtual QImage grabFrameBuffer (bool withAlpha=FALSE)
virtual void makeOverlayCurrent ()
const QGLContextoverlayContext () const
void setMouseTracking (bool enable)
virtual void reparent (QWidget *parent, WFlags f, const QPoint &p, bool showIt=FALSE)
const QGLColormapcolormap () const
void setColormap (const QGLColormap &map)
void renderText (int x, int y, const QString &str, const QFont &fnt=QFont(), int listBase=2000)
void renderText (double x, double y, double z, const QString &str, const QFont &fnt=QFont(), int listBase=2000)
 QGLWidget (QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0)
 QGLWidget (QGLContext *context, QWidget *parent, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0)
 QGLWidget (const QGLFormat &format, QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0)
 ~QGLWidget ()
void qglColor (const QColor &c) const
void qglClearColor (const QColor &c) const
bool isValid () const
bool isSharing () const
virtual void makeCurrent ()
void doneCurrent ()
bool doubleBuffer () const
virtual void swapBuffers ()
QGLFormat format () const
virtual void setFormat (const QGLFormat &format)
const QGLContextcontext () const
virtual void setContext (QGLContext *context, const QGLContext *shareContext=0, bool deleteOldContext=TRUE)
virtual QPixmap renderPixmap (int w=0, int h=0, bool useContext=FALSE)
virtual QImage grabFrameBuffer (bool withAlpha=FALSE)
virtual void makeOverlayCurrent ()
const QGLContextoverlayContext () const
void setMouseTracking (bool enable)
virtual void reparent (QWidget *parent, WFlags f, const QPoint &p, bool showIt=FALSE)
const QGLColormapcolormap () const
void setColormap (const QGLColormap &map)
void renderText (int x, int y, const QString &str, const QFont &fnt=QFont(), int listBase=2000)
void renderText (double x, double y, double z, const QString &str, const QFont &fnt=QFont(), int listBase=2000)

Métodos públicos estáticos

static QImage convertToGLFormat (const QImage &img)
static QImage convertToGLFormat (const QImage &img)

Métodos protegidos

virtual void initializeGL ()
virtual void resizeGL (int w, int h)
virtual void paintGL ()
virtual void initializeOverlayGL ()
virtual void resizeOverlayGL (int w, int h)
virtual void paintOverlayGL ()
void setAutoBufferSwap (bool on)
bool autoBufferSwap () const
void paintEvent (QPaintEvent *)
void resizeEvent (QResizeEvent *)
virtual void glInit ()
virtual void glDraw ()
virtual void initializeGL ()
virtual void resizeGL (int w, int h)
virtual void paintGL ()
virtual void initializeOverlayGL ()
virtual void resizeOverlayGL (int w, int h)
virtual void paintOverlayGL ()
void setAutoBufferSwap (bool on)
bool autoBufferSwap () const
void paintEvent (QPaintEvent *)
void resizeEvent (QResizeEvent *)
virtual void glInit ()
virtual void glDraw ()

Descripción detallada

The QGLWidget class is a widget for rendering OpenGL graphics.

OpenGL.

QGLWidget provides functionality for displaying OpenGL* graphics integrated into a Qt application. It is very simple to use. You inherit from it and use the subclass like any other QWidget, except that instead of drawing the widget's contents using QPainter etc. you use the standard OpenGL rendering commands.

QGLWidget provides three convenient virtual functions that you can reimplement in your subclass to perform the typical OpenGL tasks:

paintGL() - Renders the OpenGL scene. Gets called whenever the widget needs to be updated. resizeGL() - Sets up the OpenGL viewport, projection, etc. Gets called whenever the the widget has been resized (and also when it is shown for the first time because all newly created widgets get a resize event automatically). initializeGL() - Sets up the OpenGL rendering context, defines display lists, etc. Gets called once before the first time resizeGL() or paintGL() is called.

Here is a rough outline of how a QGLWidget subclass might look:

    class MyGLDrawer : public QGLWidget
    {
        Q_OBJECT        // must include this if you use Qt signals/slots

    public:
        MyGLDrawer( QWidget *parent, const char *name )
            : QGLWidget(parent, name) {}

    protected:

        void initializeGL()
        {
            // Set up the rendering context, define display lists etc.:
            ...
            glClearColor( 0.0, 0.0, 0.0, 0.0 );
            glEnable(GL_DEPTH_TEST);
            ...
        }

        void resizeGL( int w, int h )
        {
            // setup viewport, projection etc.:
            glViewport( 0, 0, (GLint)w, (GLint)h );
            ...
            glFrustum( ... );
            ...
        }

        void paintGL()
        {
            // draw the scene:
            ...
            glRotatef( ... );
            glMaterialfv( ... );
            glBegin( GL_QUADS );
            glVertex3f( ... );
            glVertex3f( ... );
            ...
            glEnd();
            ...
        }

    };

If you need to trigger a repaint from places other than paintGL() (a typical example is when using timers to animate scenes), you should call the widget's updateGL() function.

Your widget's OpenGL rendering context is made current when paintGL(), resizeGL(), or initializeGL() is called. If you need to call the standard OpenGL API functions from other places (e.g. in your widget's constructor or in your own paint functions), you must call makeCurrent() first.

QGLWidget provides functions for requesting a new display format and you can also create widgets with customized rendering contexts.

You can also share OpenGL display lists between QGLWidgets (see the documentation of the QGLWidget constructors for details).


Documentación del constructor y destructor

QGLWidget::QGLWidget ( QWidget parent = 0,
const char *  name = 0,
const QGLWidget shareWidget = 0,
WFlags  f = 0 
)

Constructs an OpenGL widget with a parent widget and a name.

The default format is used. The widget will be invalid if the system has no OpenGL support.

The parent, name and widget flag, f, arguments are passed to the QWidget constructor.

If the shareWidget parameter points to a valid QGLWidget, this widget will share OpenGL display lists with shareWidget. If this widget and shareWidget have different formats, display list sharing may fail. You can check whether display list sharing succeeded by calling isSharing().

The initialization of OpenGL rendering state, etc. should be done by overriding the initializeGL() function, rather than in the constructor of your QGLWidget subclass.

Ver también:
QGLFormat::defaultFormat()
QGLWidget::QGLWidget ( QGLContext context,
QWidget parent,
const char *  name = 0,
const QGLWidget shareWidget = 0,
WFlags  f = 0 
)

Constructs an OpenGL widget with parent parent, called name.

The context argument is a pointer to the QGLContext that you wish to be bound to this widget. This allows you to pass in your own QGLContext sub-classes.

The widget will be invalid if the system has no OpenGL support.

The parent, name and widget flag, f, arguments are passed to the QWidget constructor.

If the shareWidget parameter points to a valid QGLWidget, this widget will share OpenGL display lists with shareWidget. If this widget and shareWidget have different formats, display list sharing may fail. You can check whether display list sharing succeeded by calling isSharing().

The initialization of OpenGL rendering state, etc. should be done by overriding the initializeGL() function, rather than in the constructor of your QGLWidget subclass.

Ver también:
QGLFormat::defaultFormat(), isValid()
QGLWidget::QGLWidget ( const QGLFormat format,
QWidget parent = 0,
const char *  name = 0,
const QGLWidget shareWidget = 0,
WFlags  f = 0 
)

Constructs an OpenGL widget with parent parent, called name.

The format argument specifies the desired rendering options . 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.

The widget will be invalid if the system has no OpenGL support.

The parent, name and widget flag, f, arguments are passed to the QWidget constructor.

If the shareWidget parameter points to a valid QGLWidget, this widget will share OpenGL display lists with shareWidget. If this widget and shareWidget have different formats, display list sharing may fail. You can check whether display list sharing succeeded by calling isSharing().

The initialization of OpenGL rendering state, etc. should be done by overriding the initializeGL() function, rather than in the constructor of your QGLWidget subclass.

Ver también:
QGLFormat::defaultFormat(), isValid()
QGLWidget::~QGLWidget ( )

Destroys the widget.

QGLWidget::QGLWidget ( QWidget parent = 0,
const char *  name = 0,
const QGLWidget shareWidget = 0,
WFlags  f = 0 
)
QGLWidget::QGLWidget ( QGLContext context,
QWidget parent,
const char *  name = 0,
const QGLWidget shareWidget = 0,
WFlags  f = 0 
)
QGLWidget::QGLWidget ( const QGLFormat format,
QWidget parent = 0,
const char *  name = 0,
const QGLWidget shareWidget = 0,
WFlags  f = 0 
)
QGLWidget::~QGLWidget ( )

Documentación de las funciones miembro

bool QGLWidget::autoBufferSwap ( ) const [inline, protected]

Returns TRUE if the widget is doing automatic GL buffer swapping; otherwise returns FALSE.

Ver también:
setAutoBufferSwap()
bool QGLWidget::autoBufferSwap ( ) const [protected]
QGLColormap & QGLWidget::colormap ( ) const

Returns the colormap for this widget.

Usually it is only top-level widgets that can have different colormaps installed. Asking for the colormap of a child widget will return the colormap for the child's top-level widget.

If no colormap has been set for this widget, the QColormap returned will be empty.

Ver también:
setColormap()
const QGLColormap& QGLWidget::colormap ( ) const
const QGLContext * QGLWidget::context ( ) const [inline]

Returns the context of this widget.

It is possible that the context is not valid (see isValid()), for example, if the underlying hardware does not support the format attributes that were requested.

const QGLContext* QGLWidget::context ( ) const
QImage QGLWidget::convertToGLFormat ( const QImage img) [static]

Converts the image img into the unnamed format expected by OpenGL functions such as glTexImage2D(). The returned image is not usable as a QImage, but QImage::width(), QImage::height() and QImage::bits() may be used with OpenGL. The following few lines are from the texture example. Most of the code is irrelevant, so we just quote the relevant bits:

opengl/texture/gltexobj.cpp tex1 tex1 gllogo.bmp

We create tex1 (and another variable) for OpenGL, and load a real image into buf.

convertToGLFormat convertToGLFormat

A few lines later, we convert buf into OpenGL format and store it in tex1.

glTexImage2D glTexImage2D tex1.bits

Note the dimension restrictions for texture images as described in the glTexImage2D() documentation. The width must be 2^m + 2*border and the height 2^n + 2*border where m and n are integers and border is either 0 or 1.

Another function in the same example uses tex1 with OpenGL.

static QImage QGLWidget::convertToGLFormat ( const QImage img) [static]
void QGLWidget::doneCurrent ( )

Makes no GL context the current context. Normally, you do not need to call this function; QGLContext calls it as necessary. However, it may be useful in multithreaded environments.

void QGLWidget::doneCurrent ( )
bool QGLWidget::doubleBuffer ( ) const
bool QGLWidget::doubleBuffer ( ) const [inline]

Returns TRUE if the contained GL rendering context has double buffering; otherwise returns FALSE.

Ver también:
QGLFormat::doubleBuffer()
QGLFormat QGLWidget::format ( ) const [inline]

Returns the format of the contained GL rendering context.

QGLFormat QGLWidget::format ( ) const
void QGLWidget::glDraw ( ) [protected, virtual]

Executes the virtual function paintGL().

The widget's rendering context will become the current context and initializeGL() will be called if it hasn't already been called.

virtual void QGLWidget::glDraw ( ) [protected, virtual]
virtual void QGLWidget::glInit ( ) [protected, virtual]
void QGLWidget::glInit ( ) [protected, virtual]

Initializes OpenGL for this widget's context. Calls the virtual function initializeGL().

virtual QImage QGLWidget::grabFrameBuffer ( bool  withAlpha = FALSE) [virtual]
QImage QGLWidget::grabFrameBuffer ( bool  withAlpha = FALSE) [virtual]

Returns an image of the frame buffer. If withAlpha is TRUE the alpha channel is included.

Depending on your hardware, you can explicitly select which color buffer to grab with a glReadBuffer() call before calling this function.

void QGLWidget::initializeGL ( ) [protected, virtual]

This virtual function is called once before the first call to paintGL() or resizeGL(), and then once whenever the widget has been assigned a new QGLContext. Reimplement it in a subclass.

This function should set up any required OpenGL context rendering flags, defining display lists, etc.

There is no need to call makeCurrent() because this has already been done when this function is called.

virtual void QGLWidget::initializeGL ( ) [protected, virtual]
virtual void QGLWidget::initializeOverlayGL ( ) [protected, virtual]
void QGLWidget::initializeOverlayGL ( ) [protected, virtual]

This virtual function is used in the same manner as initializeGL() except that it operates on the widget's overlay context instead of the widget's main context. This means that initializeOverlayGL() is called once before the first call to paintOverlayGL() or resizeOverlayGL(). Reimplement it in a subclass.

This function should set up any required OpenGL context rendering flags, defining display lists, etc. for the overlay context.

There is no need to call makeOverlayCurrent() because this has already been done when this function is called.

bool QGLWidget::isSharing ( ) const
bool QGLWidget::isSharing ( ) const

Returns TRUE if display list sharing with another QGLWidget was requested in the constructor, and the GL system was able to provide it; otherwise returns FALSE. The GL system may fail to provide display list sharing if the two QGLWidgets use different formats.

Ver también:
format()
bool QGLWidget::isValid ( void  ) const

Returns TRUE if the widget has a valid GL rendering context; otherwise returns FALSE. A widget will be invalid if the system has no OpenGL support.

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

Makes this widget the current widget for OpenGL operations, i.e. makes the widget's rendering context the current OpenGL rendering context.

virtual void QGLWidget::makeOverlayCurrent ( ) [virtual]
void QGLWidget::makeOverlayCurrent ( ) [virtual]

Makes the overlay context of this widget current. Use this if you need to issue OpenGL commands to the overlay context outside of initializeOverlayGL(), resizeOverlayGL(), and paintOverlayGL().

Does nothing if this widget has no overlay.

Ver también:
makeCurrent()
const QGLContext * QGLWidget::overlayContext ( ) const

Returns the overlay context of this widget, or 0 if this widget has no overlay.

Ver también:
context()
const QGLContext* QGLWidget::overlayContext ( ) const
void QGLWidget::paintEvent ( QPaintEvent ) [protected, virtual]

Handles paint events. Will cause the virtual paintGL() function to be called.

The widget's rendering context will become the current context and initializeGL() will be called if it hasn't already been called.

Reimplementado de QWidget.

void QGLWidget::paintEvent ( QPaintEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive paint events.

A paint event is a request to repaint all or part of the widget. It can happen as a result of repaint() or update(), or because the widget was obscured and has now been uncovered, or for many other reasons.

Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QCanvas do this, for example.

Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::unite()). repaint() does not permit this optimization, so we suggest using update() when possible.

When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background. There are a couple of exceptions and QPaintEvent::erased() tells you whether the widget has been erased or not.

The background can be set using setBackgroundMode(), setPaletteBackgroundColor() or setBackgroundPixmap(). The documentation for setBackgroundMode() elaborates on the background; we recommend reading it.

Ver también:
event(), repaint(), update(), QPainter, QPixmap, QPaintEvent

Reimplementado de QWidget.

virtual void QGLWidget::paintGL ( ) [protected, virtual]
void QGLWidget::paintGL ( ) [protected, virtual]

This virtual function is called whenever the widget needs to be painted. Reimplement it in a subclass.

There is no need to call makeCurrent() because this has already been done when this function is called.

void QGLWidget::paintOverlayGL ( ) [protected, virtual]

This virtual function is used in the same manner as paintGL() except that it operates on the widget's overlay context instead of the widget's main context. This means that paintOverlayGL() is called whenever the widget's overlay needs to be painted. Reimplement it in a subclass.

There is no need to call makeOverlayCurrent() because this has already been done when this function is called.

virtual void QGLWidget::paintOverlayGL ( ) [protected, virtual]
void QGLWidget::qglClearColor ( const QColor c) const
void QGLWidget::qglClearColor ( const QColor c) const

Convenience function for specifying the clearing color to OpenGL. Calls glClearColor (in RGBA mode) or glClearIndex (in color-index mode) with the color c. Applies to the current GL context.

Ver también:
qglColor(), QGLContext::currentContext(), QColor
void QGLWidget::qglColor ( const QColor c) const
void QGLWidget::qglColor ( const QColor c) const

Convenience function for specifying a drawing color to OpenGL. Calls glColor3 (in RGBA mode) or glIndex (in color-index mode) with the color c. Applies to the current GL context.

Ver también:
qglClearColor(), QGLContext::currentContext(), QColor
virtual QPixmap QGLWidget::renderPixmap ( int  w = 0,
int  h = 0,
bool  useContext = FALSE 
) [virtual]
QPixmap QGLWidget::renderPixmap ( int  w = 0,
int  h = 0,
bool  useContext = FALSE 
) [virtual]

Renders the current scene on a pixmap and returns the pixmap.

You can use this method on both visible and invisible QGLWidgets.

This method will create a pixmap and a temporary QGLContext to render on the pixmap. It will then call initializeGL(), resizeGL(), and paintGL() on this context. Finally, the widget's original GL context is restored.

The size of the pixmap will be w pixels wide and h pixels high unless one of these parameters is 0 (the default), in which case the pixmap will have the same size as the widget.

If useContext is TRUE, this method will try to be more efficient by using the existing GL context to render the pixmap. The default is FALSE. Only use TRUE if you understand the risks.

Overlays are not rendered onto the pixmap.

If the GL rendering context and the desktop have different bit depths, the result will most likely look surprising.

Note that the creation of display lists, modifications of the view frustum etc. should be done from within initializeGL(). If this is not done, the temporary QGLContext will not be initialized properly, and the rendered pixmap may be incomplete/corrupted.

void QGLWidget::renderText ( int  x,
int  y,
const QString str,
const QFont fnt = QFont(),
int  listBase = 2000 
)
void QGLWidget::renderText ( int  x,
int  y,
const QString str,
const QFont fnt = QFont(),
int  listBase = 2000 
)

Renders the string str into the GL context of this widget.

x and y are specified in window coordinates, with the origin in the upper left-hand corner of the window. If fnt is not specified, the currently set application font will be used to render the string. To change the color of the rendered text you can use the glColor() call (or the qglColor() convenience function), just before the renderText() call. Note that if you have GL_LIGHTING enabled, the string will not appear in the color you want. You should therefore switch lighting off before using renderText().

listBase specifies the index of the first display list that is generated by this function. The default value is 2000. 256 display lists will be generated, one for each of the first 256 characters in the font that is used to render the string. If several fonts are used in the same widget, the display lists for these fonts will follow the last generated list. You would normally not have to change this value unless you are using lists in the same range. The lists are deleted when the widget is destroyed.

Note: This function only works reliably with ASCII strings.

void QGLWidget::renderText ( double  x,
double  y,
double  z,
const QString str,
const QFont fnt = QFont(),
int  listBase = 2000 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. x, y and z are specified in scene or object coordinates relative to the currently set projection and model matrices. This can be useful if you want to annotate models with text labels and have the labels move with the model as it is rotated etc.

void QGLWidget::renderText ( double  x,
double  y,
double  z,
const QString str,
const QFont fnt = QFont(),
int  listBase = 2000 
)
virtual void QGLWidget::reparent ( QWidget parent,
WFlags  f,
const QPoint p,
bool  showIt = FALSE 
) [virtual]

Reparents the widget. The widget gets a new parent, new widget flags (f, but as usual, use 0) at a new position in its new parent (p).

If showIt is TRUE, show() is called once the widget has been reparented.

If the new parent widget is in a different top-level widget, the reparented widget and its children are appended to the end of the tab chain of the new parent widget, in the same internal order as before. If one of the moved widgets had keyboard focus, reparent() calls clearFocus() for that widget.

If the new parent widget is in the same top-level widget as the old parent, reparent doesn't change the tab order or keyboard focus.

Atención:
It is extremely unlikely that you will ever need this function. If you have a widget that changes its content dynamically, it is far easier to use QWidgetStack or QWizard.
Ver también:
getWFlags()

Reimplementado de QWidget.

virtual void QGLWidget::reparent ( QWidget parent,
WFlags  f,
const QPoint p,
bool  showIt = FALSE 
) [virtual]

Reparents the widget. The widget gets a new parent, new widget flags (f, but as usual, use 0) at a new position in its new parent (p).

If showIt is TRUE, show() is called once the widget has been reparented.

If the new parent widget is in a different top-level widget, the reparented widget and its children are appended to the end of the tab chain of the new parent widget, in the same internal order as before. If one of the moved widgets had keyboard focus, reparent() calls clearFocus() for that widget.

If the new parent widget is in the same top-level widget as the old parent, reparent doesn't change the tab order or keyboard focus.

Atención:
It is extremely unlikely that you will ever need this function. If you have a widget that changes its content dynamically, it is far easier to use QWidgetStack or QWizard.
Ver también:
getWFlags()

Reimplementado de QWidget.

void QGLWidget::resizeEvent ( QResizeEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive widget resize events. When resizeEvent() is called, the widget already has its new geometry. The old size is accessible through QResizeEvent::oldSize().

The widget will be erased and receive a paint event immediately after processing the resize event. No drawing need be (or should be) done inside this handler.

Widgets that have been created with the WNoAutoErase flag will not be erased. Nevertheless, they will receive a paint event for their entire area afterwards. Again, no drawing needs to be done inside this handler.

The default implementation calls updateMask() if the widget has automatic masking enabled.

Ver también:
moveEvent(), event(), resize(), QResizeEvent, paintEvent()

Reimplementado de QWidget.

void QGLWidget::resizeEvent ( QResizeEvent ) [protected, virtual]

Handles resize events. Calls the virtual function resizeGL().

Reimplementado de QWidget.

virtual void QGLWidget::resizeGL ( int  w,
int  h 
) [protected, virtual]
void QGLWidget::resizeGL ( int  width,
int  height 
) [protected, virtual]

This virtual function is called whenever the widget has been resized. The new size is passed in width and height. Reimplement it in a subclass.

There is no need to call makeCurrent() because this has already been done when this function is called.

virtual void QGLWidget::resizeOverlayGL ( int  w,
int  h 
) [protected, virtual]
void QGLWidget::resizeOverlayGL ( int  width,
int  height 
) [protected, virtual]

This virtual function is used in the same manner as paintGL() except that it operates on the widget's overlay context instead of the widget's main context. This means that resizeOverlayGL() is called whenever the widget has been resized. The new size is passed in width and height. Reimplement it in a subclass.

There is no need to call makeOverlayCurrent() because this has already been done when this function is called.

void QGLWidget::setAutoBufferSwap ( bool  on) [protected]
void QGLWidget::setAutoBufferSwap ( bool  on) [inline, protected]

If on is TRUE automatic GL buffer swapping is switched on; otherwise it is switched off.

If on is TRUE and the widget is using a double-buffered format, the background and foreground GL buffers will automatically be swapped after each paintGL() call.

The buffer auto-swapping is on by default.

Ver también:
autoBufferSwap(), doubleBuffer(), swapBuffers()
void QGLWidget::setColormap ( const QGLColormap map)
void QGLWidget::setColormap ( const QGLColormap cmap)

Set the colormap for this widget to cmap. Usually it is only top-level widgets that can have colormaps installed.

Ver también:
colormap()
virtual void QGLWidget::setContext ( QGLContext context,
const QGLContext shareContext = 0,
bool  deleteOldContext = TRUE 
) [virtual]
virtual void QGLWidget::setContext ( QGLContext context,
const QGLContext shareContext = 0,
bool  deleteOldContext = TRUE 
) [virtual]
void QGLWidget::setFormat ( const QGLFormat format) [virtual]
virtual void QGLWidget::setFormat ( const QGLFormat format) [virtual]
void QGLWidget::setMouseTracking ( bool  enable) [virtual]

Reimplementado de QWidget.

void QGLWidget::setMouseTracking ( bool  enable) [virtual]

Reimplementado de QWidget.

virtual void QGLWidget::swapBuffers ( ) [virtual]
void QGLWidget::swapBuffers ( ) [virtual]

Swaps the screen contents with an off-screen buffer. This only works if the widget's format specifies double buffer mode.

Normally, there is no need to explicitly call this function because it is done automatically after each widget repaint, i.e. each time after paintGL() has been executed.

Ver también:
doubleBuffer(), setAutoBufferSwap(), QGLFormat::setDoubleBuffer()
void QGLWidget::updateGL ( ) [virtual, slot]

Updates the widget by calling glDraw().

virtual void QGLWidget::updateGL ( ) [virtual, slot]
void QGLWidget::updateOverlayGL ( ) [virtual, slot]

Updates the widget's overlay (if any). Will cause the virtual function paintOverlayGL() to be executed.

The widget's rendering context will become the current context and initializeGL() will be called if it hasn't already been called.

virtual void QGLWidget::updateOverlayGL ( ) [virtual, slot]

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'