42 #include <QApplication> 43 #include <QtGui/private/qapplication_p.h> 47 #include <QtGui/private/qapplication_p.h> 48 #include <QtGui/QPlatformWindow> 134 void QGLContextPrivate::setupSharing() {
137 if (sharedPlatformGLContext) {
138 QGLContext *actualSharedContext = QGLContext::fromPlatformGLContext(sharedPlatformGLContext);
146 return QApplicationPrivate::platformIntegration()
163 if (!widget->platformWindow()){
173 widget->setPlatformWindowFormat(winFormat);
176 d->platformContext = widget->platformWindow()->glContext();
178 d->glFormat = QGLFormat::fromPlatformWindowFormat(
d->platformContext->platformWindowFormat());
179 d->valid =(bool)
d->platformContext;
203 if (
d->platformContext) {
204 d->platformContext->setQGLContextHandle(0,0);
211 d->platformContext->makeCurrent();
213 if (!
d->workaroundsCached) {
214 d->workaroundsCached =
true;
215 const char *renderer =
reinterpret_cast<const char *
>(glGetString(
GL_RENDERER));
216 if (renderer && strstr(renderer,
"Mali")) {
217 d->workaround_brokenFBOReadBack =
true;
226 d->platformContext->doneCurrent();
232 d->platformContext->swapBuffers();
238 return d->platformContext->getProcAddress(procName);
243 bool deleteOldContext)
247 qWarning(
"QGLWidget::setContext: Cannot set null context");
251 if (context->
device() == 0)
257 if (!
d->glcx->isValid())
258 d->glcx->create(shareContext ? shareContext : oldcx);
260 if (deleteOldContext)
266 initContext(context, shareWidget);
305 d->context->doneCurrent();
307 d->widget->setGeometry(0,0,3,3);
311 d->widget->setPlatformWindowFormat(format);
314 d->widget->platformWindow()->glContext()->makeCurrent();
319 d->widget->platformWindow()->glContext()->doneCurrent();
321 d->context->makeCurrent();
360 if (!
d->glcx->initialized())
362 resizeGL(width(), height());
396 d->platformContext = platformContext;
413 if (!platformContext)
static const QPlatformGLContext * currentContext()
Returns the last context which called makeCurrent.
The QColor class provides colors based on RGB, HSV or CMYK values.
virtual void swapBuffers() const
Swaps the screen contents with an off-screen buffer.
static void addShare(const QGLContext *context, const QGLContext *share)
#define QT_END_NAMESPACE
This macro expands to.
QPointer< QWidget > widget
void qDeleteQGLContext(void *handle)
void setDevice(QPaintDevice *pDev)
QColor overlayTransparentColor() const
If this context is a valid context in an overlay plane, returns the plane's transparent color...
void * getProcAddress(const QString &proc) const
Returns a function pointer to the GL extension function passed in proc.
QGLContext(const QGLFormat &format, QPaintDevice *device)
Constructs an OpenGL context for the given paint device, which can be a widget or a pixmap...
The QString class provides a Unicode character string.
static void removeShare(const QGLContext *context)
QPlatformGLContext * context
#define QT_BEGIN_NAMESPACE
This macro expands to.
void generateFontDisplayLists(const QFont &fnt, int listBase)
Generates a set of 256 display lists for the 256 first characters in the font font.
The QGLContext class encapsulates an OpenGL rendering context.
The QResizeEvent class contains event parameters for resize events.
Q_CORE_EXPORT void qWarning(const char *,...)
virtual QPlatformWindowFormat platformWindowFormat() const =0
QWidget has the function qplatformWindowFormat().
QPaintDevice * device() const
Returns the paint device set for this context.
The QGLColormap class is used for installing custom colormaps into a QGLWidget.
void reset()
Resets the context and makes it invalid.
virtual bool chooseContext(const QGLContext *shareContext=0)
This semi-internal function is called by create().
The QPlatformGLContext class provides an abstraction for native GL contexts.
The QFont class specifies a font used for drawing text.
virtual void doneCurrent()
Makes no GL context the current context.
if(void) toggleToolbarShown
virtual void makeCurrent()
Makes this context the current OpenGL rendering context.
QGLTemporaryContext(bool directRendering=true, QWidget *parent=0)
The QPixmap class is an off-screen image representation that can be used as a paint device...
uint colorIndex(const QColor &c) const
Returns a colormap index for the color c, in ColorIndex mode.
The QEvent class is the base class of all event classes.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void * qGLContextHandle() const