diff options
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/opengl.pro | 10 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 8 | ||||
-rw-r--r-- | src/opengl/qgl_cl_p.h | 2 | ||||
-rw-r--r-- | src/opengl/qgl_mac.mm | 30 | ||||
-rw-r--r-- | src/opengl/qgl_p.h | 1 | ||||
-rw-r--r-- | src/opengl/qglframebufferobject.cpp | 4 | ||||
-rw-r--r-- | src/opengl/qglpixelbuffer_egl.cpp | 8 | ||||
-rw-r--r-- | src/opengl/qglpixelbuffer_mac.mm | 6 | ||||
-rw-r--r-- | src/opengl/qglpixelbuffer_win.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qpaintengine_opengl.cpp | 57 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 6 |
11 files changed, 71 insertions, 63 deletions
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 48d7caf..78aaddb 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -25,18 +25,16 @@ HEADERS += qgl.h \ qglcolormap.h \ qglpixelbuffer.h \ qglframebufferobject.h \ - qglpixmapfilter_p.h SOURCES += qgl.cpp \ qglcolormap.cpp \ qglpixelbuffer.cpp \ qglframebufferobject.cpp \ qglextensions.cpp \ - qglpixmapfilter.cpp !contains(QT_CONFIG, opengles2) { - HEADERS += qpaintengine_opengl_p.h - SOURCES += qpaintengine_opengl.cpp + HEADERS += qpaintengine_opengl_p.h qglpixmapfilter_p.h + SOURCES += qpaintengine_opengl.cpp qglpixmapfilter.cpp } contains(QT_CONFIG, opengles2) { @@ -130,6 +128,10 @@ wince*: { contains(QT_CONFIG,opengles1cl) { QMAKE_LIBS += "libGLES_CL.lib" } + contains(QT_CONFIG,opengles2) { + QMAKE_LIBS += "libGLESv2.lib" + } + } else { QMAKE_LIBS += $$QMAKE_LIBS_OPENGL } diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 2d90342..b4a0e5c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2615,6 +2615,10 @@ const QGLContext* QGLContext::currentContext() QGLWidget. This will side-step the issue altogether, and is what we recommend for users that need this kind of functionality. + On Mac OS X, when Qt is built with Cocoa support, a QGLWidget + can't have any sibling widgets placed ontop of itself. This is due + to limitations in the Cocoa API and is not supported by Apple. + \section1 Overlays The QGLWidget creates a GL overlay context in addition to the @@ -3230,6 +3234,10 @@ bool QGLWidget::event(QEvent *e) update(); } return true; +# if defined(QT_MAC_USE_COCOA) + } else if (e->type() == QEvent::MacGLClearDrawable) { + d->glcx->d_ptr->clearDrawable(); +# endif } #endif diff --git a/src/opengl/qgl_cl_p.h b/src/opengl/qgl_cl_p.h index e514ff5..c05a7d7 100644 --- a/src/opengl/qgl_cl_p.h +++ b/src/opengl/qgl_cl_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE inline void glTexParameterf (GLenum target, GLenum pname, GLfloat param) { - glTexParameterx(target, pname, param); + glTexParameterx(target, pname, FLOAT2X(param)); } inline void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm index 314c659..1319396 100644 --- a/src/opengl/qgl_mac.mm +++ b/src/opengl/qgl_mac.mm @@ -87,29 +87,6 @@ QT_FORWARD_DECLARE_CLASS(QWidget) QT_FORWARD_DECLARE_CLASS(QWidgetPrivate) QT_FORWARD_DECLARE_CLASS(QGLWidgetPrivate) -@interface QT_MANGLE_NAMESPACE(QCocoaOpenGLView) : QT_MANGLE_NAMESPACE(QCocoaView) -{ -} -- (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate; -@end - -@implementation QT_MANGLE_NAMESPACE(QCocoaOpenGLView) -- (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate -{ - self = [super initWithQWidget:widget widgetPrivate:widgetprivate]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(_surfaceNeedsUpdate:) - name:NSViewGlobalFrameDidChangeNotification - object:self]; - return self; -} - -- (void) _surfaceNeedsUpdate:(NSNotification*)notification -{ - Q_UNUSED(notification); - static_cast<QGLWidgetPrivate *>(qwidgetprivate)->glcx->updatePaintDevice(); -} -@end QT_BEGIN_NAMESPACE void *qt_current_nsopengl_context() @@ -435,6 +412,11 @@ void *QGLContextPrivate::tryFormat(const QGLFormat &format) #endif } +void QGLContextPrivate::clearDrawable() +{ + [static_cast<NSOpenGLContext *>(cx) clearDrawable]; +} + /*! \bold{Mac OS X only:} This virtual function tries to find a visual that matches the format, reducing the demands if the original request @@ -647,7 +629,7 @@ void QGLContext::updatePaintDevice() // ideally we would use QWidget::isVisible(), but we get "invalid drawable" errors if (![(NSWindow *)qt_mac_window_for(w) isVisible]) return; - if ([static_cast<NSOpenGLContext *>(d->cx) view] != view) + if ([static_cast<NSOpenGLContext *>(d->cx) view] != view && ![view isHidden]) [static_cast<NSOpenGLContext *>(d->cx) setView:view]; } else if (d->paintDevice->devType() == QInternal::Pixmap) { const QPixmap *pm = static_cast<const QPixmap *>(d->paintDevice); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index b8bbeaf..16aaa96 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -234,6 +234,7 @@ public: #if defined(Q_WS_MAC) bool update; void *tryFormat(const QGLFormat &format); + void clearDrawable(); #endif QGLFormat glFormat; QGLFormat reqFormat; diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index fb22272..c362b7e 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -48,6 +48,10 @@ #include <qlibrary.h> #include <qimage.h> +#ifdef QT_OPENGL_ES_1_CL +#include "qgl_cl_p.h" +#endif + QT_BEGIN_NAMESPACE extern QImage qt_gl_read_framebuffer(const QSize&, bool, bool); diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp index 964efa2..5390fd1 100644 --- a/src/opengl/qglpixelbuffer_egl.cpp +++ b/src/opengl/qglpixelbuffer_egl.cpp @@ -47,6 +47,10 @@ #include <qimage.h> #include <private/qgl_p.h> +#ifdef QT_OPENGL_ES_1_CL +#include "qgl_cl_p.h" +#endif + QT_BEGIN_NAMESPACE #ifdef EGL_BIND_TO_TEXTURE_RGBA @@ -188,8 +192,8 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, d->req_size.width(), d->req_size.height(), 0, GL_RGB, GL_UNSIGNED_BYTE, 0); else glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, d->req_size.width(), d->req_size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); return texture; #else return 0; diff --git a/src/opengl/qglpixelbuffer_mac.mm b/src/opengl/qglpixelbuffer_mac.mm index 14941ab..9a679b1 100644 --- a/src/opengl/qglpixelbuffer_mac.mm +++ b/src/opengl/qglpixelbuffer_mac.mm @@ -308,10 +308,6 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); - [static_cast<NSOpenGLContext *>(d->share_ctx) - setTextureImageToPixelBuffer:static_cast<NSOpenGLPixelBuffer *>(d->pbuf) - colorBuffer:GL_FRONT]; - glBindTexture(GL_TEXTURE_2D, texture); // updates texture target glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); @@ -322,8 +318,6 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const GLuint texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); - aglTexImagePBuffer(d->share_ctx, d->pbuf, GL_FRONT); - glBindTexture(GL_TEXTURE_2D, texture); // updates texture target glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); return texture; diff --git a/src/opengl/qglpixelbuffer_win.cpp b/src/opengl/qglpixelbuffer_win.cpp index e81a576..e3228cc 100644 --- a/src/opengl/qglpixelbuffer_win.cpp +++ b/src/opengl/qglpixelbuffer_win.cpp @@ -43,7 +43,7 @@ #include <qgl.h> #include <private/qgl_p.h> -#include <qglpixelbuffer_p.h> +#include <private/qglpixelbuffer_p.h> #include <qimage.h> #include <qdebug.h> diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index f332a50..ec6e33b 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -1983,7 +1983,7 @@ public: void QOpenGLTrapezoidToArrayTessellator::addTrap(const Trapezoid &trap) { // On OpenGL ES we convert the trap to 2 triangles -#ifndef QT_OPENGL_ES_1 +#ifndef QT_OPENGL_ES if (size > allocated - 8) { #else if (size > allocated - 12) { @@ -1994,31 +1994,31 @@ void QOpenGLTrapezoidToArrayTessellator::addTrap(const Trapezoid &trap) QGLTrapezoid t = toGLTrapezoid(trap); -#ifndef QT_OPENGL_ES_1 - vertices[size++] = t.topLeftX; - vertices[size++] = t.top; - vertices[size++] = t.topRightX; - vertices[size++] = t.top; - vertices[size++] = t.bottomRightX; - vertices[size++] = t.bottom; - vertices[size++] = t.bottomLeftX; - vertices[size++] = t.bottom; +#ifndef QT_OPENGL_ES + vertices[size++] = f2vt(t.topLeftX); + vertices[size++] = f2vt(t.top); + vertices[size++] = f2vt(t.topRightX); + vertices[size++] = f2vt(t.top); + vertices[size++] = f2vt(t.bottomRightX); + vertices[size++] = f2vt(t.bottom); + vertices[size++] = f2vt(t.bottomLeftX); + vertices[size++] = f2vt(t.bottom); #else // First triangle - vertices[size++] = t.topLeftX; - vertices[size++] = t.top; - vertices[size++] = t.topRightX; - vertices[size++] = t.top; - vertices[size++] = t.bottomRightX; - vertices[size++] = t.bottom; + vertices[size++] = f2vt(t.topLeftX); + vertices[size++] = f2vt(t.top); + vertices[size++] = f2vt(t.topRightX); + vertices[size++] = f2vt(t.top); + vertices[size++] = f2vt(t.bottomRightX); + vertices[size++] = f2vt(t.bottom); // Second triangle - vertices[size++] = t.bottomLeftX; - vertices[size++] = t.bottom; - vertices[size++] = t.topLeftX; - vertices[size++] = t.top; - vertices[size++] = t.bottomRightX; - vertices[size++] = t.bottom; + vertices[size++] = f2vt(t.bottomLeftX); + vertices[size++] = f2vt(t.bottom); + vertices[size++] = f2vt(t.topLeftX); + vertices[size++] = f2vt(t.top); + vertices[size++] = f2vt(t.bottomRightX); + vertices[size++] = f2vt(t.bottom); #endif } @@ -3716,8 +3716,14 @@ void QOpenGLPaintEngine::drawRects(const QRectF *rects, int rectCount) d->disableClipping(); GLuint program = qt_gl_program_cache()->getProgram(d->drawable.context(), FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA, 0, true); - QGLRectMaskGenerator maskGenerator(path, d->matrix, d->offscreen, program); - d->addItem(qt_mask_texture_cache()->getMask(maskGenerator, d)); + + if (d->matrix.type() >= QTransform::TxProject) { + QGLPathMaskGenerator maskGenerator(path, d->matrix, d->offscreen, program); + d->addItem(qt_mask_texture_cache()->getMask(maskGenerator, d)); + } else { + QGLRectMaskGenerator maskGenerator(path, d->matrix, d->offscreen, program); + d->addItem(qt_mask_texture_cache()->getMask(maskGenerator, d)); + } d->enableClipping(); } @@ -5328,6 +5334,9 @@ void QOpenGLPaintEnginePrivate::composite(GLuint primitive, const q_vertexType * Q_Q(QOpenGLPaintEngine); QGL_FUNC_CONTEXT; + if (current_style == Qt::NoBrush) + return; + DEBUG_ONCE qDebug() << "QOpenGLPaintEnginePrivate: Using compositing program: fragment_brush =" << fragment_brush << ", fragment_composition_mode =" << fragment_composition_mode; diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 3dd3064..b41adf9 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -76,13 +76,17 @@ #define GLX_SAMPLES_ARB 100001 #endif +#ifdef QT_OPENGL_ES_1_CL +#include "qgl_cl_p.h" +#endif + QT_BEGIN_NAMESPACE // // QGLGraphicsSystem // #ifdef Q_WS_WIN -Q_GUI_EXPORT bool qt_win_owndc_required; +extern Q_GUI_EXPORT bool qt_win_owndc_required; #endif QGLGraphicsSystem::QGLGraphicsSystem() : QGraphicsSystem() |