⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qglcontext.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
字号:
'\" t.TH QGLContext 3qt "11 October 2001" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech AS.  All rights reserved.  See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQGLContext \- Encapsulates an OpenGL rendering context.PP\fC#include <qgl.h>\fR.PPInherits QGL..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQGLContext\fR ( const QGLFormat & format, QPaintDevice * device )".br.ti -1c.BI "virtual \fB~QGLContext\fR ()".br.ti -1c.BI "virtual bool \fBcreate\fR ( const QGLContext * shareContext = 0 )".br.ti -1c.BI "bool \fBisValid\fR () const".br.ti -1c.BI "bool \fBisSharing\fR () const".br.ti -1c.BI "virtual void \fBreset\fR ()".br.ti -1c.BI "QGLFormat \fBformat\fR () const".br.ti -1c.BI "QGLFormat \fBrequestedFormat\fR () const".br.ti -1c.BI "virtual void \fBsetFormat\fR ( const QGLFormat & format )".br.ti -1c.BI "virtual void \fBmakeCurrent\fR ()".br.ti -1c.BI "virtual void \fBswapBuffers\fR () const".br.ti -1c.BI "QPaintDevice * \fBdevice\fR () const".br.ti -1c.BI "QColor \fBoverlayTransparentColor\fR () const".br.in -1c.SS "Static Public Members".in +1c.ti -1c.BI "const QGLContext * \fBcurrentContext\fR ()".br.in -1c.SS "Protected Members".in +1c.ti -1c.BI "virtual bool \fBchooseContext\fR ( const QGLContext * shareContext = 0 )".br.ti -1c.BI "virtual void \fBdoneCurrent\fR ()".br.ti -1c.BI "virtual int \fBchoosePixelFormat\fR ( void * dummyPfd, HDC pdc )".br.ti -1c.BI "bool \fBdeviceIsPixmap\fR () const".br.ti -1c.BI "bool \fBwindowCreated\fR () const".br.ti -1c.BI "void \fBsetWindowCreated\fR ( bool on )".br.ti -1c.BI "bool \fBinitialized\fR () const".br.ti -1c.BI "void \fBsetInitialized\fR ( bool on )".br.in -1c.SH DESCRIPTIONThe QGLContext class encapsulates an OpenGL rendering context..PPAn OpenGL<sup>*</sup> rendering context is a complete set of OpenGL state variables..PPThe 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(). The context is created by the create() function which is called from the constructors. The makeCurrent() function makes this context the current rendering context. You can make \fIno\fR context current using doneCurrent(). The reset() function will reset the context and make it invalid..PPYou can examine properties of the context with, e.g. isValid(), isSharing(), initialized(), windowCreated() and overlayTransparentColor()..PPIf you're using double buffering you can swap the screen contents with the off-screen buffer using swapBuffers()..PP<sup>*</sup> OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other countries..PPSee also Graphics Classes and Image Processing Classes..SH MEMBER FUNCTION DOCUMENTATION.SH "QGLContext::QGLContext ( const QGLFormat & format, QPaintDevice * device )"Constructs an OpenGL context for the paint device \fIdevice\fR, which can be a widget or a pixmap. The \fIformat\fR specifies several display options for the context..PPIf the underlying OpenGL/Window system cannot satisfy all the features requested in \fIformat\fR, the nearest subset of features will be used. After creation, the format() method will return the actual format obtained..PPThe context will be invalid if it was not possible to obtain a GL context at all..PPSee also format() and isValid()..SH "QGLContext::~QGLContext ()\fC [virtual]\fR"Destroys the OpenGL context and frees its resources..SH "bool QGLContext::chooseContext ( const QGLContext * shareContext = 0 )\fC [virtual protected]\fR"This semi-internal function is called by create(). It creates a system-dependent OpenGL handle that matches the format() of \fIshareContext\fR as closely as possible..PPOn 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..SH "int QGLContext::choosePixelFormat ( void * dummyPfd, HDC pdc )\fC [virtual protected]\fR"\fBWin32 only\fR This virtual function chooses a pixel format that matches the OpenGL format. Reimplement this function in a subclass if you need a custom context..PP\fBWarning:\fR The \fIdummyPfd\fR pointer and \fIpdc\fR are used as a \fCPIXELFORMATDESCRIPTOR*\fR. We use \fCvoid\fR to avoid using Windows-specific types in our header files..PPSee also chooseContext()..SH "bool QGLContext::create ( const QGLContext * shareContext = 0 )\fC [virtual]\fR"Creates the GL context. Returns TRUE if it was successful in creating a GL rendering context on the paint device specified in the constructor; otherwise returns FALSE (i.e. the context is invalid)..PPAfter successful creation, format() returns the set of features of the created GL rendering context..PPIf \fIshareContext\fR points to a valid QGLContext, this method will try to establish OpenGL display list sharing between this context and the \fIshareContext\fR. Note that this may fail if the two contexts have different formats. Use isSharing() to see if sharing succeeded..PP\fBImplementation note:\fR 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..PPSee also chooseContext(), format() and isValid()..SH "const QGLContext * QGLContext::currentContext ()\fC [static]\fR"Returns the current context, i.e. the context to which any OpenGL commands will currently be directed. Returns 0 if no context is current..PPSee also makeCurrent()..SH "QPaintDevice * QGLContext::device () const"Returns the paint device set for this context..PPSee also QGLContext::QGLContext()..SH "bool QGLContext::deviceIsPixmap () const\fC [protected]\fR"Returns TRUE if the paint device of this context is a pixmap; otherwise returns FALSE..SH "void QGLContext::doneCurrent ()\fC [virtual protected]\fR"Makes no GL context the current context. Normally, you do not need to call this function; QGLContext calls it as necessary..SH "QGLFormat QGLContext::format () const"Returns the frame buffer format that was obtained (this may be a subset of what was requested)..PPSee also requestedFormat()..SH "bool QGLContext::initialized () const\fC [protected]\fR"Returns TRUE if this context has been initialized, i.e. if QGLWidget::initializeGL() has been performed on it; otherwise returns FALSE..PPSee also setInitialized()..SH "bool QGLContext::isSharing () const"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..SH "bool QGLContext::isValid () const"Returns TRUE if a GL rendering context has been successfully created; otherwise returns FALSE..SH "void QGLContext::makeCurrent ()\fC [virtual]\fR"Makes this context the current OpenGL rendering context. All GL functions you call operate on this context until another context is made current..SH "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..PPThe 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.).PPThe 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..SH "QGLFormat QGLContext::requestedFormat () const"Returns the frame buffer format that was originally requested in the constructor or setFormat()..PPSee also format()..SH "void QGLContext::reset ()\fC [virtual]\fR"Resets the context and makes it invalid..PPSee also create() and isValid()..SH "void QGLContext::setFormat ( const QGLFormat & format )\fC [virtual]\fR"Sets a \fIformat\fR for this context. The context is reset..PPCall create() to create a new GL context that tries to match the new format..PP.nf.br    QGLContext *cx;.br    //  ....br    QGLFormat f;.br    f.setStereo( TRUE );.br    cx->setFormat( f );.br    if ( !cx->create() ).br        exit(); // no OpenGL support, or cannot render on the specified paintdevice.br    if ( !cx->format().stereo() ).br        exit(); // could not create stereo context.br.fi.PPSee also format(), reset() and create()..SH "void QGLContext::setInitialized ( bool on )\fC [protected]\fR"If \fIon\fR is TRUE the context has been initialized, i.e. QGLContext::setInitialized() has been called on it. If \fIon\fR is FALSE the context has not been initialized..PPSee also initialized()..SH "void QGLContext::setWindowCreated ( bool on )\fC [protected]\fR"If \fIon\fR is TRUE the context has had a window created for it. If \fIon\fR is FALSE no window has been created for the context..PPSee also windowCreated()..SH "void QGLContext::swapBuffers () const\fC [virtual]\fR"Swaps the screen contents with an off-screen buffer. Works only if the context is in double buffer mode..PPSee also QGLFormat::setDoubleBuffer()..SH "bool QGLContext::windowCreated () const\fC [protected]\fR"Returns TRUE if a window has been created for this context; otherwise returns FALSE..PPSee also setWindowCreated()..SH "SEE ALSO".BR http://doc.trolltech.com/qglcontext.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com.  See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qglcontext.3qt) and the Qtversion (3.0.0).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -