summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl_egl.cpp2
-rw-r--r--src/opengl/qgl_qws.cpp2
-rw-r--r--src/opengl/qglpixelbuffer_egl.cpp15
3 files changed, 14 insertions, 5 deletions
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 7e91c35..348a677 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -74,7 +74,7 @@ void qt_egl_set_format(QEglProperties& props, int deviceType, const QGLFormat& f
props.setValue(EGL_STENCIL_SIZE, f.stencilBufferSize() == -1 ? 1 : f.stencilBufferSize());
if (f.sampleBuffers()) {
props.setValue(EGL_SAMPLE_BUFFERS, 1);
- props.setValue(EGL_SAMPLES, f.samples());
+ props.setValue(EGL_SAMPLES, f.samples() == -1 ? 1 : f.samples());
} else {
props.setValue(EGL_SAMPLE_BUFFERS, 0);
}
diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp
index b842426..4058b66 100644
--- a/src/opengl/qgl_qws.cpp
+++ b/src/opengl/qgl_qws.cpp
@@ -187,6 +187,8 @@ void QGLContext::reset()
d->cleanup();
doneCurrent();
if (d->eglContext) {
+ if (d->eglContext->surface() != EGL_NO_SURFACE)
+ eglDestroySurface(d->eglContext->display(), d->eglContext->surface());
delete d->eglContext;
d->eglContext = 0;
}
diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp
index b2f16c1..fbe6c36 100644
--- a/src/opengl/qglpixelbuffer_egl.cpp
+++ b/src/opengl/qglpixelbuffer_egl.cpp
@@ -152,7 +152,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
bool QGLPixelBufferPrivate::cleanup()
{
- eglDestroySurface(QEglContext::defaultDisplay(0), pbuf);
+ // No need to destroy "pbuf" here - it is done in QGLContext::reset().
return true;
}
@@ -203,13 +203,20 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const
bool QGLPixelBuffer::hasOpenGLPbuffers()
{
// See if we have at least 1 configuration that matches the default format.
- QEglContext ctx;
- if (!ctx.openDisplay(0))
+ EGLDisplay dpy = QEglContext::defaultDisplay(0);
+ if (dpy == EGL_NO_DISPLAY)
return false;
QEglProperties configProps;
qt_egl_set_format(configProps, QInternal::Pbuffer, QGLFormat::defaultFormat());
configProps.setRenderableType(QEglContext::OpenGL);
- return ctx.chooseConfig(configProps, QEglContext::BestPixelFormat);
+ do {
+ EGLConfig cfg = 0;
+ EGLint matching = 0;
+ if (eglChooseConfig(dpy, configProps.properties(),
+ &cfg, 1, &matching) && matching > 0)
+ return true;
+ } while (configProps.reduceConfiguration());
+ return false;
}
QT_END_NAMESPACE