Changeset 769 for trunk/src/opengl


Ignore:
Timestamp:
Aug 2, 2010, 9:27:30 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.3 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/opengl/gl2paintengineex/qglengineshadermanager.cpp

    r651 r769  
    266266    do {
    267267        QByteArray source;
     268        // Insert the custom stage before the srcPixel shader to work around an ATI driver bug
     269        // where you cannot forward declare a function that takes a sampler as argument.
     270        if (prog.srcPixelFragShader == CustomImageSrcFragmentShader)
     271            source.append(prog.customStageSource);
    268272        source.append(qShaderSnippets[prog.mainFragShader]);
    269273        source.append(qShaderSnippets[prog.srcPixelFragShader]);
    270         if (prog.srcPixelFragShader == CustomImageSrcFragmentShader)
    271             source.append(prog.customStageSource);
    272274        if (prog.compositionFragShader)
    273275            source.append(qShaderSnippets[prog.compositionFragShader]);
     
    766768    QGLContextPrivate* ctx_d = ctx->d_func();
    767769    ctx_d->setVertexAttribArrayEnabled(QT_VERTEX_COORDS_ATTR, true);
    768     ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, currentShaderProg->useTextureCoords);
    769     ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, currentShaderProg->useOpacityAttribute);
     770    ctx_d->setVertexAttribArrayEnabled(QT_TEXTURE_COORDS_ATTR, currentShaderProg && currentShaderProg->useTextureCoords);
     771    ctx_d->setVertexAttribArrayEnabled(QT_OPACITY_ATTR, currentShaderProg && currentShaderProg->useOpacityAttribute);
    770772
    771773    shaderProgNeedsChanging = false;
  • trunk/src/opengl/gl2paintengineex/qglengineshadersource_p.h

    r651 r769  
    332332    uniform   lowp    sampler2D imageTexture; \n\
    333333    lowp vec4 srcPixel() \n\
    334     { \n\
    335         return texture2D(imageTexture, textureCoords); \n\
    336     }\n";
     334    { \n"
     335#ifdef QT_OPENGL_ES_2
     336        // work-around for driver bug
     337        "return 1.0 * texture2D(imageTexture, textureCoords); \n"
     338#else
     339        "return texture2D(imageTexture, textureCoords); \n"
     340#endif
     341    "}\n";
    337342
    338343static const char* const qglslCustomSrcFragmentShader = "\n\
    339344    varying   highp   vec2      textureCoords; \n\
    340345    uniform   lowp    sampler2D imageTexture; \n\
    341     lowp vec4 customShader(lowp sampler2D texture, highp vec2 coords); \n\
    342346    lowp vec4 srcPixel() \n\
    343347    { \n\
  • trunk/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp

    r651 r769  
    9090
    9191//#define QT_GL_NO_SCISSOR_TEST
     92#if defined(Q_WS_WIN)
     93extern Q_GUI_EXPORT bool qt_cleartype_enabled;
     94#endif
    9295
    9396extern QImage qt_imageForBrush(int brushStyle, bool invert);
     
    182185
    183186        glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT);
    184         ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, true, QGLContext::InternalBindOption);
     187        ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption);
    185188        updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform);
    186189    }
     
    12321235                                            : d->glyphCacheType;
    12331236
    1234     if (txtype > QTransform::TxTranslate)
    1235         glyphType = QFontEngineGlyphCache::Raster_A8;
    1236 
    1237     if (glyphType == QFontEngineGlyphCache::Raster_RGBMask
    1238         && state()->composition_mode != QPainter::CompositionMode_Source
    1239         && state()->composition_mode != QPainter::CompositionMode_SourceOver)
    1240     {
    1241         drawCached = false;
     1237
     1238    if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
     1239        if (d->device->alphaRequested() || txtype > QTransform::TxTranslate
     1240            || (state()->composition_mode != QPainter::CompositionMode_Source
     1241            && state()->composition_mode != QPainter::CompositionMode_SourceOver))
     1242        {
     1243            glyphType = QFontEngineGlyphCache::Raster_A8;
     1244        }
    12421245    }
    12431246
     
    15561559#if !defined(QT_OPENGL_ES_2)
    15571560#if defined(Q_WS_WIN)
    1558     extern Q_GUI_EXPORT bool qt_cleartype_enabled;
    15591561    if (qt_cleartype_enabled)
    15601562#endif
     
    15961598    delete d->shaderManager;
    15971599    d->shaderManager = 0;
     1600    d->currentBrush = QBrush();
    15981601
    15991602#ifdef QT_OPENGL_CACHE_AS_VBOS
  • trunk/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp

    r651 r769  
    4242#include "qtextureglyphcache_gl_p.h"
    4343#include "qpaintengineex_opengl2_p.h"
     44
     45QT_BEGIN_NAMESPACE
    4446
    4547#ifdef Q_WS_WIN
     
    244246#endif
    245247}
     248
     249QT_END_NAMESPACE
  • trunk/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp

    r651 r769  
    145145
    146146    const qreal *endPts = pts + (count<<1);
    147     const qreal *startPts;
     147    const qreal *startPts = 0;
    148148
    149149    Qt::PenCapStyle cap = m_cap_style;
    150150
    151151    if (!types) {
     152        // skip duplicate points
     153        while((pts + 2) < endPts && pts[0] == pts[2] && pts[1] == pts[3])
     154            pts += 2;
     155        if ((pts + 2) == endPts)
     156            return;
     157
    152158        startPts = pts;
    153159
     
    162168        pts += 2;
    163169        while (pts < endPts) {
    164             join(pts);
    165             lineTo(pts);
     170            if (m_cx != pts[0] || m_cy != pts[1]) {
     171                join(pts);
     172                lineTo(pts);
     173            }
    166174            pts += 2;
    167175        }
     
    170178
    171179    } else {
    172         bool endsAtStart;
     180        bool endsAtStart = false;
    173181        while (pts < endPts) {
    174182            switch (*types) {
  • trunk/src/opengl/qgl.cpp

    r651 r769  
    103103#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
    104104QGLExtensionFuncs QGLContextPrivate::qt_extensionFuncs;
     105#endif
     106
     107#ifdef Q_WS_X11
     108extern const QX11Info *qt_x11Info(const QPaintDevice *pd);
    105109#endif
    106110
     
    15311535            for (int x=0; x < w; ++x) {
    15321536                const uint pixel = *q;
    1533                 *q = ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff) | (pixel & 0xff00ff00);
     1537                if (alpha_format && include_alpha) {
     1538                    *q = ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff)
     1539                         | (pixel & 0xff00ff00);
     1540                } else {
     1541                    *q = 0xff000000 | ((pixel << 16) & 0xff0000)
     1542                         | ((pixel >> 16) & 0xff) | (pixel & 0x00ff00);
     1543                }
     1544
    15341545                q++;
    15351546            }
     
    15421553QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha)
    15431554{
    1544     QImage img(size, alpha_format ? QImage::Format_ARGB32 : QImage::Format_RGB32);
     1555    QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32
     1556                                                     : QImage::Format_RGB32);
    15451557    int w = size.width();
    15461558    int h = size.height();
     
    15911603    qt_gl_texture_cache = this;
    15921604
    1593     QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(cleanupTextures);
     1605    QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(cleanupTexturesForPixampData);
    15941606    QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(cleanupBeforePixmapDestruction);
    1595     QImagePixmapCleanupHooks::instance()->addImageHook(imageCleanupHook);
     1607    QImagePixmapCleanupHooks::instance()->addImageHook(cleanupTexturesForCacheKey);
    15961608}
    15971609
     
    16001612    qt_gl_texture_cache = 0;
    16011613
    1602     QImagePixmapCleanupHooks::instance()->removePixmapDataModificationHook(cleanupTextures);
     1614    QImagePixmapCleanupHooks::instance()->removePixmapDataModificationHook(cleanupTexturesForPixampData);
    16031615    QImagePixmapCleanupHooks::instance()->removePixmapDataDestructionHook(cleanupBeforePixmapDestruction);
    1604     QImagePixmapCleanupHooks::instance()->removeImageHook(imageCleanupHook);
     1616    QImagePixmapCleanupHooks::instance()->removeImageHook(cleanupTexturesForCacheKey);
    16051617}
    16061618
     
    16581670  is deref'ed
    16591671*/
    1660 void QGLTextureCache::imageCleanupHook(qint64 cacheKey)
    1661 {
    1662     // ### remove when the GL texture cache becomes thread-safe
    1663     if (qApp->thread() != QThread::currentThread())
    1664         return;
    1665     QGLTexture *texture = instance()->getTexture(cacheKey);
    1666     if (texture && texture->options & QGLContext::MemoryManagedBindOption)
    1667         instance()->remove(cacheKey);
    1668 }
    1669 
    1670 
    1671 void QGLTextureCache::cleanupTextures(QPixmapData* pmd)
     1672void QGLTextureCache::cleanupTexturesForCacheKey(qint64 cacheKey)
    16721673{
    16731674    // ### remove when the GL texture cache becomes thread-safe
    16741675    if (qApp->thread() == QThread::currentThread()) {
    1675         const qint64 cacheKey = pmd->cacheKey();
    1676         QGLTexture *texture = instance()->getTexture(cacheKey);
    1677         if (texture && texture->options & QGLContext::MemoryManagedBindOption)
    1678             instance()->remove(cacheKey);
    1679     }
     1676        instance()->remove(cacheKey);
     1677        Q_ASSERT(instance()->getTexture(cacheKey) == 0);
     1678    }
     1679}
     1680
     1681
     1682void QGLTextureCache::cleanupTexturesForPixampData(QPixmapData* pmd)
     1683{
     1684    cleanupTexturesForCacheKey(pmd->cacheKey());
    16801685}
    16811686
     
    16831688{
    16841689    // Remove any bound textures first:
    1685     cleanupTextures(pmd);
    1686     Q_ASSERT(instance()->getTexture(pmd->cacheKey()) == 0);
     1690    cleanupTexturesForPixampData(pmd);
    16871691
    16881692#if defined(Q_WS_X11)
     
    20852089    Q_ASSERT(texture);
    20862090
    2087     if (texture->id > 0)
    2088         QImagePixmapCleanupHooks::enableCleanupHooks(image);
     2091    // Enable the cleanup hooks for this image so that the texture cache entry is removed when the
     2092    // image gets deleted:
     2093    QImagePixmapCleanupHooks::enableCleanupHooks(image);
    20892094
    20902095    return texture;
     
    21402145
    21412146    QImage img = image;
     2147
    21422148    if (!(QGLExtensions::glExtensions() & QGLExtensions::NPOTTextures)
    21432149        && !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0)
     
    23082314    QGLTexture *texture = new QGLTexture(q, tx_id, target, options);
    23092315    QGLTextureCache::instance()->insert(q, key, texture, cost);
     2316
    23102317    return texture;
    23112318}
     
    23522359#if defined(Q_WS_X11)
    23532360    // Try to use texture_from_pixmap
    2354     if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType) {
     2361    const QX11Info *xinfo = qt_x11Info(paintDevice);
     2362    if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType
     2363        && xinfo && xinfo->screen() == pixmap.x11Info().screen())
     2364    {
    23552365        texture = bindTextureFromNativePixmap(pd, key, options);
    23562366        if (texture) {
     
    24212431
    24222432    Q_D(QGLContext);
    2423     QGLTexture *texture = d->bindTexture(image, target, format, false, DefaultBindOption);
     2433    QGLTexture *texture = d->bindTexture(image, target, format, DefaultBindOption);
    24242434    return texture->id;
    24252435}
     
    25612571        GLuint texture = dds_cache->value(ddsKeys.at(i));
    25622572        if (id == texture) {
    2563             glDeleteTextures(1, &texture);
    25642573            dds_cache->remove(ddsKeys.at(i));
    2565             return;
     2574            break;
    25662575        }
    25672576    }
     2577
     2578    // Finally, actually delete the texture ID
     2579    glDeleteTextures(1, &id);
    25682580}
    25692581
     
    44164428
    44174429    QPaintEngine::Type oldEngineType = qgl_engine_selector()->preferredPaintEngine();
     4430
     4431    QPaintEngine *engine = paintEngine();
     4432    if (engine && (oldEngineType == QPaintEngine::OpenGL2) && engine->isActive()) {
     4433        qWarning("QGLWidget::renderText(): Calling renderText() while a GL 2 paint engine is"
     4434                 " active on the same device is not allowed.");
     4435        return;
     4436    }
     4437
     4438    // this changes what paintEngine() returns
    44184439    qgl_engine_selector()->setPreferredPaintEngine(QPaintEngine::OpenGL);
    4419     QPaintEngine *engine = paintEngine();
     4440    engine = paintEngine();
    44204441    QPainter *p;
    44214442    bool reuse_painter = false;
     
    45104531
    45114532    QPaintEngine::Type oldEngineType = qgl_engine_selector()->preferredPaintEngine();
     4533    QPaintEngine *engine = paintEngine();
     4534
     4535    if (engine && (oldEngineType == QPaintEngine::OpenGL2) && engine->isActive()) {
     4536        qWarning("QGLWidget::renderText(): Calling renderText() while a GL 2 paint engine is"
     4537                 " active on the same device is not allowed.");
     4538        return;
     4539    }
     4540
     4541    // this changes what paintEngine() returns
    45124542    qgl_engine_selector()->setPreferredPaintEngine(QPaintEngine::OpenGL);
    4513     QPaintEngine *engine = paintEngine();
     4543    engine = paintEngine();
    45144544    QPainter *p;
    45154545    bool reuse_painter = false;
     
    54305460    quint32 width = pvrHeader->width;
    54315461    quint32 height = pvrHeader->height;
    5432     while (bufferSize > 0 && level < pvrHeader->mipMapCount) {
     5462    while (bufferSize > 0 && level <= pvrHeader->mipMapCount) {
    54335463        quint32 size =
    54345464            (qMax(width, minWidth) * qMax(height, minHeight) *
  • trunk/src/opengl/qgl_mac.mm

    r651 r769  
    952952        current = current->parentWidget();
    953953    }
    954 
    955     isGLWidget = 1;
    956954}
    957955
  • trunk/src/opengl/qgl_p.h

    r651 r769  
    8181#endif //QT_OPENGL_ES_1_CL
    8282
    83 #ifdef QT_OPENGL_ES
     83#if defined(QT_OPENGL_ES) || defined(QT_OPENGL_ES_2)
    8484QT_BEGIN_INCLUDE_NAMESPACE
     85
    8586#if defined(QT_OPENGL_ES_2)
    86 #include <EGL/egl.h>
     87#   include <GLES2/gl2.h>
     88#endif
     89
     90#if defined(QT_GLES_EGL)
     91#   include <GLES/egl.h>
    8792#else
    88 #include <GLES/egl.h>
    89 #endif
     93#   include <EGL/egl.h>
     94#endif
     95
    9096QT_END_INCLUDE_NAMESPACE
    9197#endif
     
    180186                       , eglSurfaceWindowId(0)
    181187#endif
    182         {}
     188    {
     189        isGLWidget = 1;
     190    }
    183191
    184192    ~QGLWidgetPrivate() {}
     
    539547    static QGLTextureCache *instance();
    540548    static void deleteIfEmpty();
    541     static void imageCleanupHook(qint64 cacheKey);
    542     static void cleanupTextures(QPixmapData* pixmap);
     549    static void cleanupTexturesForCacheKey(qint64 cacheKey);
     550    static void cleanupTexturesForPixampData(QPixmapData* pixmap);
    543551    static void cleanupBeforePixmapDestruction(QPixmapData* pixmap);
    544552
     
    571579
    572580// One resource per group of shared contexts.
    573 class Q_AUTOTEST_EXPORT QGLContextResource
     581class Q_OPENGL_EXPORT QGLContextResource
    574582{
    575583public:
  • trunk/src/opengl/qgl_qws.cpp

    r651 r769  
    199199    d->eglContext = new QEglContext();
    200200    d->eglContext->setApi(QEgl::OpenGL);
    201     if (!d->eglContext->openDisplay(device())) {
    202         delete d->eglContext;
    203         d->eglContext = 0;
    204         return false;
    205     }
    206201
    207202    // Construct the configuration we need for this surface.
  • trunk/src/opengl/qgl_wince.cpp

    r651 r769  
    156156    d->eglContext = new QEglContext();
    157157    d->eglContext->setApi(QEgl::OpenGL);
    158     if (!d->eglContext->openDisplay(device())) {
    159         delete d->eglContext;
    160         d->eglContext = 0;
    161         return false;
    162     }
    163158
    164159    // Construct the configuration we need for this surface.
  • trunk/src/opengl/qgl_x11.cpp

    r651 r769  
    16571657        int screen = xinfo ? xinfo->screen() : X11->defaultScreen;
    16581658
    1659         QGLExtensionMatcher extensions(glXQueryExtensionsString(display, screen));
    1660         if (extensions.match("GLX_EXT_texture_from_pixmap")) {
     1659        QGLExtensionMatcher serverExtensions(glXQueryExtensionsString(display, screen));
     1660        QGLExtensionMatcher clientExtensions(glXGetClientString(display, GLX_EXTENSIONS));
     1661        if (serverExtensions.match("GLX_EXT_texture_from_pixmap")
     1662            && clientExtensions.match("GLX_EXT_texture_from_pixmap"))
     1663        {
    16611664            glXBindTexImageEXT = (qt_glXBindTexImageEXT) qglx_getProcAddress("glXBindTexImageEXT");
    16621665            glXReleaseTexImageEXT = (qt_glXReleaseTexImageEXT) qglx_getProcAddress("glXReleaseTexImageEXT");
  • trunk/src/opengl/qgl_x11egl.cpp

    r651 r769  
    191191        d->eglContext = new QEglContext();
    192192        d->eglContext->setApi(QEgl::OpenGL);
    193         if (!d->eglContext->openDisplay(device())) {
    194             delete d->eglContext;
    195             d->eglContext = 0;
    196             return false;
    197         }
    198193
    199194        // Construct the configuration we need for this surface.
     
    615610        EGLint configCount = 0;
    616611        do {
    617             eglChooseConfig(QEglContext::defaultDisplay(0), configAttribs.properties(), targetConfig, 1, &configCount);
     612            eglChooseConfig(QEglContext::display(), configAttribs.properties(), targetConfig, 1, &configCount);
    618613            if (configCount > 0) {
    619614                // Got one
     
    654649
    655650    EGLSurface pixmapSurface;
    656     pixmapSurface = eglCreatePixmapSurface(QEglContext::defaultDisplay(0),
     651    pixmapSurface = eglCreatePixmapSurface(QEglContext::display(),
    657652                                           pixmapConfig,
    658653                                           (EGLNativePixmapType) pixmapData->handle(),
     
    763758    if (pixmapData->gl_surface) {
    764759        EGLBoolean success;
    765         success = eglDestroySurface(QEglContext::defaultDisplay(0), (EGLSurface)pixmapData->gl_surface);
     760        success = eglDestroySurface(QEglContext::display(), (EGLSurface)pixmapData->gl_surface);
    766761        if (success == EGL_FALSE) {
    767762            qWarning() << "destroyGlSurfaceForPixmap() - Error deleting surface: "
     
    778773    if (pixmapData->gl_surface) {
    779774        EGLBoolean success;
    780         success = eglReleaseTexImage(QEglContext::defaultDisplay(0),
     775        success = eglReleaseTexImage(QEglContext::display(),
    781776                                     (EGLSurface)pixmapData->gl_surface,
    782777                                     EGL_BACK_BUFFER);
  • trunk/src/opengl/qglframebufferobject.cpp

    r651 r769  
    330330        fboFormat.setDepth(true);
    331331    }
     332
     333    GLenum format = f->format().internalTextureFormat();
     334    reqAlpha = (format != GL_RGB
     335#ifndef QT_OPENGL_ES
     336                && format != GL_RGB5 && format != GL_RGB8
     337#endif
     338    );
    332339}
    333340
  • trunk/src/opengl/qglframebufferobject_p.h

    r651 r769  
    112112    virtual QGLContext* context() const;
    113113    virtual QGLFormat format() const {return fboFormat;}
     114    virtual bool alphaRequested() const { return reqAlpha; }
    114115
    115116    void setFBO(QGLFramebufferObject* f,
     
    117118
    118119private:
    119     bool wasBound;
    120120    QGLFramebufferObject* fbo;
    121121    QGLFormat fboFormat;
     122    bool wasBound;
     123    bool reqAlpha;
    122124};
    123125
  • trunk/src/opengl/qglpaintdevice.cpp

    r651 r769  
    127127{
    128128    return context()->format();
     129}
     130
     131bool QGLPaintDevice::alphaRequested() const
     132{
     133    return context()->d_func()->reqFormat.alpha();
    129134}
    130135
  • trunk/src/opengl/qglpaintdevice_p.h

    r651 r769  
    7676    virtual QGLFormat format() const;
    7777    virtual QSize size() const = 0;
     78    virtual bool alphaRequested() const;
    7879
    7980    // returns the QGLPaintDevice for the given QPaintDevice
  • trunk/src/opengl/qglpixelbuffer_egl.cpp

    r651 r769  
    6565    ctx = new QEglContext();
    6666    ctx->setApi(QEgl::OpenGL);
    67 
    68     // Open the EGL display.
    69     if (!ctx->openDisplay(0)) {
    70         delete ctx;
    71         ctx = 0;
    72         return false;
    73     }
    7467
    7568    // Find the shared context.
     
    216209{
    217210    // See if we have at least 1 configuration that matches the default format.
    218     EGLDisplay dpy = QEglContext::defaultDisplay(0);
     211    EGLDisplay dpy = QEglContext::display();
    219212    if (dpy == EGL_NO_DISPLAY)
    220213        return false;
  • trunk/src/opengl/qglpixelbuffer_x11.cpp

    r651 r769  
    182182    qt_format_to_attrib_list(f, attribs);
    183183
    184     GLXFBConfig *configs = glXChooseFBConfig(X11->display, X11->defaultScreen, attribs, &num_configs);
     184    int screen = X11->defaultScreen;
     185    if (shareWidget)
     186        screen = shareWidget->x11Info().screen();
     187
     188    GLXFBConfig *configs = glXChooseFBConfig(X11->display, screen, attribs, &num_configs);
    185189    if (configs && num_configs) {
    186190        int res;
  • trunk/src/opengl/qglpixmapfilter.cpp

    r651 r769  
    395395    if (!hookAdded) {
    396396        QImagePixmapCleanupHooks::instance()->addPixmapDataDestructionHook(pixmapDestroyed);
     397        QImagePixmapCleanupHooks::instance()->addPixmapDataModificationHook(pixmapDestroyed);
    397398        hookAdded = true;
    398399    }
     
    591592        qt_blurImage(image, r * qreal(0.5), false, 1);
    592593
    593         GLuint texture = generateBlurTexture(image.size(), GL_ALPHA);
    594 
    595         glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, image.width(), image.height(), GL_ALPHA,
    596                         GL_UNSIGNED_BYTE, image.bits());
     594        GLuint texture;
     595        glGenTextures(1, &texture);
     596        glBindTexture(GL_TEXTURE_2D, texture);
     597        glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, image.width(), image.height(),
     598                     0, GL_ALPHA, GL_UNSIGNED_BYTE, image.bits());
    597599
    598600        info = new QGLBlurTextureInfo(image, texture, r);
  • trunk/src/opengl/qglshaderprogram.cpp

    r651 r769  
    970970    is linked will be assigned locations automatically.
    971971
     972    When this function is called after the program has been linked,
     973    the program will need to be relinked for the change to take effect.
     974
    972975    \sa attributeLocation()
    973976*/
     
    975978{
    976979    Q_D(QGLShaderProgram);
    977     if (!d->linked) {
    978         glBindAttribLocation(d->programGuard.id(), location, name);
    979     } else {
    980         qWarning() << "QGLShaderProgram::bindAttributeLocation(" << name
    981                    << "): cannot bind after shader program is linked";
    982     }
     980    if (!init())
     981        return;
     982    glBindAttribLocation(d->programGuard.id(), location, name);
     983    d->linked = false;  // Program needs to be relinked.
    983984}
    984985
     
    991992    is linked will be assigned locations automatically.
    992993
     994    When this function is called after the program has been linked,
     995    the program will need to be relinked for the change to take effect.
     996
    993997    \sa attributeLocation()
    994998*/
     
    10051009    Any attributes that have not been explicitly bound when the program
    10061010    is linked will be assigned locations automatically.
     1011
     1012    When this function is called after the program has been linked,
     1013    the program will need to be relinked for the change to take effect.
    10071014
    10081015    \sa attributeLocation()
  • trunk/src/opengl/qpaintengine_opengl.cpp

    r651 r769  
    14541454    qt_mask_texture_cache()->maintainCache();
    14551455
     1456#if defined(Q_WS_X11)
     1457    // clear out the references we hold for textures bound with the
     1458    // texture_from_pixmap extension
     1459    ctx->d_func()->boundPixmaps.clear();
     1460#endif
    14561461    return true;
    14571462}
  • trunk/src/opengl/qpixmapdata_gl.cpp

    r651 r769  
    235235}
    236236
     237bool QGLPixmapGLPaintDevice::alphaRequested() const
     238{
     239    return data->m_hasAlpha;
     240}
     241
    237242void QGLPixmapGLPaintDevice::setPixmapData(QGLPixmapData* d)
    238243{
  • trunk/src/opengl/qpixmapdata_gl_p.h

    r651 r769  
    8989    QGLContext* context() const;
    9090    QSize size() const;
     91    bool alphaRequested() const;
    9192
    9293    void setPixmapData(QGLPixmapData*);
  • trunk/src/opengl/qpixmapdata_x11gl_egl.cpp

    r651 r769  
    9797            EGL_NONE
    9898        };
    99         qPixmapARGBSharedEglContext = eglCreateContext(QEglContext::defaultDisplay(0),
     99        qPixmapARGBSharedEglContext = eglCreateContext(QEglContext::display(),
    100100                                                       argbConfig, 0, contextAttribs);
    101101
     
    104104            qPixmapRGBSharedEglContext = qPixmapARGBSharedEglContext;
    105105        } else {
    106             qPixmapRGBSharedEglContext = eglCreateContext(QEglContext::defaultDisplay(0),
     106            qPixmapRGBSharedEglContext = eglCreateContext(QEglContext::display(),
    107107                                                           rgbConfig, 0, contextAttribs);
    108108        }
     
    115115            break;
    116116
    117         haveX11Pixmaps = eglMakeCurrent(QEglContext::defaultDisplay(0),
     117        haveX11Pixmaps = eglMakeCurrent(QEglContext::display(),
    118118                                        (EGLSurface)argbPixmapData->gl_surface,
    119119                                        (EGLSurface)argbPixmapData->gl_surface,
     
    135135                break;
    136136
    137             haveX11Pixmaps = eglMakeCurrent(QEglContext::defaultDisplay(0),
     137            haveX11Pixmaps = eglMakeCurrent(QEglContext::display(),
    138138                                            (EGLSurface)rgbPixmapData->gl_surface,
    139139                                            (EGLSurface)rgbPixmapData->gl_surface,
     
    148148
    149149    if (qPixmapARGBSharedEglContext || qPixmapRGBSharedEglContext) {
    150         eglMakeCurrent(QEglContext::defaultDisplay(0),
     150        eglMakeCurrent(QEglContext::display(),
    151151                       EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    152152    }
     
    168168        // Clean up the context(s) if we can't use X11GL pixmaps
    169169        if (qPixmapARGBSharedEglContext != EGL_NO_CONTEXT)
    170             eglDestroyContext(QEglContext::defaultDisplay(0), qPixmapARGBSharedEglContext);
     170            eglDestroyContext(QEglContext::display(), qPixmapARGBSharedEglContext);
    171171
    172172        if (qPixmapRGBSharedEglContext != qPixmapARGBSharedEglContext &&
    173173            qPixmapRGBSharedEglContext != EGL_NO_CONTEXT)
    174174        {
    175             eglDestroyContext(QEglContext::defaultDisplay(0), qPixmapRGBSharedEglContext);
     175            eglDestroyContext(QEglContext::display(), qPixmapRGBSharedEglContext);
    176176        }
    177177        qPixmapRGBSharedEglContext = EGL_NO_CONTEXT;
     
    213213        if (ctx->d_func()->eglContext == 0)
    214214            ctx->d_func()->eglContext = new QEglContext();
    215         ctx->d_func()->eglContext->openDisplay(0); // ;-)
    216215        ctx->d_func()->eglContext->setApi(QEgl::OpenGL);
    217216        ctx->d_func()->eglContext->setContext(hasAlphaChannel() ? qPixmapARGBSharedEglContext
Note: See TracChangeset for help on using the changeset viewer.