📄 qglwidget.3qt
字号:
.TH QGLWidget 3qt "10 November 2000" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2000 Trolltech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQGLWidget \- Widget for rendering OpenGL graphics<h1 align=center>QGLWidget Class Reference.br<small>[ OpenGL module ]</small></h1>.br.PP\fC#include <qgl.h>\fR.PPInherits QGL and QWidget..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQGLWidget\fR ( QWidget * " "parent" "=0, const char * " "name" "=0, const QGLWidget * " "shareWidget" " = 0, WFlags " "f" "=0 ) ".br.ti -1c.BI "\fBQGLWidget\fR ( const QGLFormat & " "format" ", QWidget * " "parent" "=0, const char * " "name" "=0, const QGLWidget * " "shareWidget" " = 0, WFlags " "f" "=0 ) ".br.ti -1c.BI "\fB~QGLWidget\fR () ".br.ti -1c.BI "void \fBqglColor\fR ( const QColor & c ) const".br.ti -1c.BI "void \fBqglClearColor\fR ( const QColor & c ) const".br.ti -1c.BI "bool \fBisValid\fR () const".br.ti -1c.BI "bool \fBisSharing\fR () const".br.ti -1c.BI "virtual void \fBmakeCurrent\fR () ".br.ti -1c.BI "bool \fBdoubleBuffer\fR () const".br.ti -1c.BI "virtual void \fBswapBuffers\fR () ".br.ti -1c.BI "QGLFormat \fBformat\fR () const".br.ti -1c.BI "const QGLContext* \fBcontext\fR () const".br.ti -1c.BI "virtual QPixmap \fBrenderPixmap\fR ( int " "w" " = 0, int " "h" " = 0, bool " "useContext" " = FALSE ) ".br.ti -1c.BI "virtual void \fBmakeOverlayCurrent\fR () ".br.ti -1c.BI "const QGLContext* \fBoverlayContext\fR () const".br.in -1c.SS "Public Slots".in +1c.ti -1c.BI "virtual void \fBupdateGL\fR () ".br.ti -1c.BI "virtual void \fBupdateOverlayGL\fR () ".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "QImage \fBconvertToGLFormat\fR ( const QImage & img ) ".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual void \fBinitializeGL\fR () ".br.ti -1c.BI "virtual void \fBresizeGL\fR ( int " "w" ", int h ) ".br.ti -1c.BI "virtual void \fBpaintGL\fR () ".br.ti -1c.BI "virtual void \fBinitializeOverlayGL\fR () ".br.ti -1c.BI "virtual void \fBresizeOverlayGL\fR ( int " "w" ", int h ) ".br.ti -1c.BI "virtual void \fBpaintOverlayGL\fR () ".br.ti -1c.BI "void \fBsetAutoBufferSwap\fR ( bool on ) ".br.ti -1c.BI "bool \fBautoBufferSwap\fR () const".br.ti -1c.BI "virtual void \fBpaintEvent\fR ( QPaintEvent * ) ".br.ti -1c.BI "virtual void \fBresizeEvent\fR ( QResizeEvent * ) ".br.ti -1c.BI "virtual void \fBglInit\fR () ".br.ti -1c.BI "virtual void \fBglDraw\fR () ".br.in -1c.SH DESCRIPTIONThe QGLWidget class is a widget for rendering OpenGL graphics..PPQGLWidget provides functionality for displaying OpenGL graphics integrated in a Qt application. It is very simple to use: you inherit from it and use the subclass like any other QWidget, only that instead of drawing the widget's contents using QPainter & al., you use the standard OpenGL rendering commands..PPQGLWidget provides three convenient virtual functions that you can reimplement in your subclass to perform the typical OpenGL tasks:.TPpaintGL() - Render the OpenGL scene. Gets called whenever the widget needs to be updated..TPresizeGL() - Set up OpenGL viewport, projection etc. Gets called whenever the the widget has been resized (and also when it shown for the first time, since all newly created widgets get a resize event automatically)..TPinitializeGL() - Set up the OpenGL rendering context, define display lists etc. Gets called once before the first time resizeGL() or paintGL() is called..PPHere is a rough outline of how your QGLWidget subclass may look:.PP.nf.br class MyGLDrawer : public QGLWidget.br {.br Q_OBJECT // must include this if you use Qt signals/slots.br.br public:.br MyGLDrawer( QWidget *parent, const char *name ).br : QGLWidget(parent,name) {}.br.br protected:.br.br void initializeGL().br {.br // Set up the rendering context, define display lists etc.:.br ....br glClearColor( 0.0, 0.0, 0.0, 0.0 );.br glEnable(GL_DEPTH_TEST);.br ....br }.br.br void resizeGL( int w, int h ).br {.br // setup viewport, projection etc.:.br glViewport( 0, 0, (GLint)w, (GLint)h );.br ....br glFrustum( ... );.br ....br }.br.br void paintGL().br {.br // draw the scene:.br ....br glRotatef( ... );.br glMaterialfv( ... );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -