![]() |
| ||
Classes - Annotated - Tree - Functions - Home - Structure |
The QGLContext class encapsulates an OpenGL rendering context. More...
#include <qgl.h>
Inherits QGL.
An OpenGL rendering context is a complete set of OpenGL state variables.
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 context will be invalid if it was not possible to obtain a GL context at all.
See also format() and isValid().
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.
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 shareContext. Note that this may fail if the two contexts have different formats. Use isSharing() to test.
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 trouble is that virtual functions are not properly called during construction (which is indeed correct C++), hence we need a create() function.
See also chooseContext(), format() and isValid().
Returns the current context, i.e., the context to which any OpenGL commands will currently be directed. Returns 0 if no context is current.
See also makeCurrent().
Returns the paint device set for this context.
See also QGLContext::QGLContext().
Returns TRUE if the paint device of this context is a pixmap, otherwise FALSE.
Makes no GL context the current context. Normally, you do not need to call this function; QGLContext calls it as necessary.
See also requestedFormat().
Returns TRUE if this context has been initialized, i.e., if QGLWidget::initializeGL() has been performed on it.
See also setInitialized().
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. Note that display list sharing may possibly not be supported between contexts with different formats.
Makes this context the current OpenGL rendering context. All GL functions you call operate on this context until another context is made current.
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. The color's RGB values are meaningless, of course.
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 "overlay_x11" example for details.
Returns the frame buffer format that was originally requested in the constructor or setFormat().
See also format().
Resets the context and makes it invalid.
See also create() and isValid().
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 specified paintdevice if ( !cx->format().stereo() ) exit(); // could not create stereo context
See also format(), reset() and create().
Tells the context whether it has been initialized, i.e., whether QGLWidget::initializeGL() has been performed on it.
See also initialized().
Tells the context whether a window has already been created for it.
See also windowCreated().
Swaps the screen contents with an off-screen buffer. Works only if the context is in double buffer mode.
See also QGLFormat::setDoubleBuffer().
Returns TRUE if a window has been created for this context, otherwise FALSE.
See also setWindowCreated().
Search the documentation, FAQ, qt-interest archive and more (uses
www.trolltech.com):
This file is part of the Qt toolkit, copyright © 1995-2001 Trolltech, all rights reserved.
Copyright © 2001 Trolltech | Trademarks | Qt version 3.0.0-beta1-beta1
|