summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl.cpp2
-rw-r--r--src/opengl/qgl_egl.cpp1
-rw-r--r--src/opengl/qgl_mac.mm11
-rw-r--r--src/opengl/qglextensions.cpp4
-rw-r--r--src/opengl/qglframebufferobject.cpp4
-rw-r--r--src/opengl/qglshaderprogram.cpp2
-rw-r--r--src/opengl/qwindowsurface_gl.cpp19
-rw-r--r--src/opengl/qwindowsurface_gl_p.h1
8 files changed, 37 insertions, 7 deletions
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 6068dcb..71d42a5 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -1994,7 +1994,7 @@ struct DDSFormat {
option helps preserve this default behavior.
\omitvalue CanFlipNativePixmapBindOption Used by x11 from pixmap to choose
- wether or not it can bind the pixmap upside down or not.
+ whether or not it can bind the pixmap upside down or not.
\omitvalue MemoryManagedBindOption Used by paint engines to
indicate that the pixmap should be memory managed along side with
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 3763926..a154325 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -240,6 +240,7 @@ void QGLContextPrivate::destroyEglSurfaceForDevice()
if (QGLWidget *wgl = qobject_cast<QGLWidget *>(w)) {
if (wgl->d_func()->eglSurfaceWindowId != wgl->winId()) {
qWarning("WARNING: Potential EGL surface leak! Not destroying surface.");
+ eglSurface = EGL_NO_SURFACE;
return;
}
}
diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm
index 4d7532e..66fe7d3 100644
--- a/src/opengl/qgl_mac.mm
+++ b/src/opengl/qgl_mac.mm
@@ -804,17 +804,22 @@ void QGLContext::generateFontDisplayLists(const QFont & /* fnt */, int /* listBa
static CFBundleRef qt_getOpenGLBundle()
{
CFBundleRef bundle = 0;
+ CFStringRef urlString = QCFString::toCFStringRef(QLatin1String("/System/Library/Frameworks/OpenGL.framework"));
QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
- QCFString::toCFStringRef(QLatin1String("/System/Library/Frameworks/OpenGL.framework")), kCFURLPOSIXPathStyle, false);
+ urlString, kCFURLPOSIXPathStyle, false);
if (url)
bundle = CFBundleCreate(kCFAllocatorDefault, url);
+ CFRelease(urlString);
return bundle;
}
void *QGLContext::getProcAddress(const QString &proc) const
{
- return CFBundleGetFunctionPointerForName(QCFType<CFBundleRef>(qt_getOpenGLBundle()),
- QCFString(proc));
+ CFStringRef procName = QCFString(proc).toCFStringRef(proc);
+ void *result = CFBundleGetFunctionPointerForName(QCFType<CFBundleRef>(qt_getOpenGLBundle()),
+ procName);
+ CFRelease(procName);
+ return result;
}
#ifndef QT_MAC_USE_COCOA
/*****************************************************************************
diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp
index 8e2bbd4..6aec8ae 100644
--- a/src/opengl/qglextensions.cpp
+++ b/src/opengl/qglextensions.cpp
@@ -255,6 +255,10 @@ bool qt_resolve_glsl_extensions(QGLContext *ctx)
glFramebufferTextureLayerEXT = (_glFramebufferTextureLayerEXT) ctx->getProcAddress(QLatin1String("glFramebufferTextureLayerEXT"));
glFramebufferTextureFaceEXT = (_glFramebufferTextureFaceEXT) ctx->getProcAddress(QLatin1String("glFramebufferTextureFaceEXT"));
+ // Must at least have the FragmentShader extension to continue.
+ if (!(QGLExtensions::glExtensions() & QGLExtensions::FragmentShader))
+ return false;
+
glCreateShader = (_glCreateShader) ctx->getProcAddress(QLatin1String("glCreateShader"));
if (glCreateShader) {
glShaderSource = (_glShaderSource) ctx->getProcAddress(QLatin1String("glShaderSource"));
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index fe60e83..876e97a 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -445,11 +445,11 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz,
GLint maxSamples;
glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples);
- samples = qBound(1, int(samples), int(maxSamples));
+ samples = qBound(0, int(samples), int(maxSamples));
glGenRenderbuffers(1, &color_buffer);
glBindRenderbuffer(GL_RENDERBUFFER_EXT, color_buffer);
- if (glRenderbufferStorageMultisampleEXT) {
+ if (glRenderbufferStorageMultisampleEXT && samples > 0) {
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER_EXT, samples,
internal_format, size.width(), size.height());
} else {
diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp
index c7689b8..74382b0 100644
--- a/src/opengl/qglshaderprogram.cpp
+++ b/src/opengl/qglshaderprogram.cpp
@@ -2121,7 +2121,7 @@ void QGLShaderProgram::setUniformValue(int location, const QSize& size)
Q_D(QGLShaderProgram);
Q_UNUSED(d);
if (location != -1) {
- GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.width())};
+ GLfloat values[4] = {GLfloat(size.width()), GLfloat(size.height())};
glUniform2fv(location, 1, values);
}
}
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 6b82ed3..b86fb78 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -199,6 +199,7 @@ public:
return widget;
}
+ // destroys the share widget and prevents recreation
void cleanup() {
QGLWidget *w = widget;
cleanedUp = true;
@@ -206,6 +207,20 @@ public:
delete w;
}
+ // destroys the share widget, but allows it to be recreated later on
+ void destroy() {
+ if (cleanedUp)
+ return;
+
+ QGLWidget *w = widget;
+
+ // prevent potential recursions
+ cleanedUp = true;
+ widget = 0;
+ delete w;
+ cleanedUp = false;
+ }
+
static bool cleanedUp;
private:
@@ -233,6 +248,10 @@ QGLWidget* qt_gl_share_widget()
return _qt_gl_share_widget()->shareWidget();
}
+void qt_destroy_gl_share_widget()
+{
+ _qt_gl_share_widget()->destroy();
+}
struct QGLWindowSurfacePrivate
{
diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h
index 5e670fe..ffc2e86 100644
--- a/src/opengl/qwindowsurface_gl_p.h
+++ b/src/opengl/qwindowsurface_gl_p.h
@@ -67,6 +67,7 @@ class QWidget;
struct QGLWindowSurfacePrivate;
Q_OPENGL_EXPORT QGLWidget* qt_gl_share_widget();
+Q_OPENGL_EXPORT void qt_destroy_gl_share_widget();
class QGLWindowSurfaceGLPaintDevice : public QGLPaintDevice
{