qglwidget.3qt man page

QGLWidget — Widget for rendering OpenGL graphics

Synopsis

#include <qgl.h>

Inherits QWidget and QGL.

Public Members

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

const QGLContext * context () const

virtual QPixmap renderPixmap ( int w = 0, int h = 0, bool useContext = FALSE )

virtual QImage grabFrameBuffer ( bool withAlpha = FALSE )

virtual void makeOverlayCurrent ()

const QGLContext * overlayContext () const

const QGLColormap & colormap () const

void setColormap ( const QGLColormap & cmap )

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 )

Public Slots

virtual void updateGL ()

virtual void updateOverlayGL ()

Static Public Members

QImage convertToGLFormat ( const QImage & img )

Protected Members

virtual void initializeGL ()

virtual void resizeGL ( int width, int height )

virtual void paintGL ()

virtual void initializeOverlayGL ()

virtual void resizeOverlayGL ( int width, int height )

virtual void paintOverlayGL ()

void setAutoBufferSwap ( bool on )

bool autoBufferSwap () const

virtual void paintEvent ( QPaintEvent * )

virtual void resizeEvent ( QResizeEvent * )

virtual void glInit ()

virtual void glDraw ()

Description

The QGLWidget class is a widget for rendering OpenGL graphics.

QGLWidget provides functionality for displaying OpenGL<sup>*</sup> 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 b