diff options
Diffstat (limited to 'src/opengl')
-rw-r--r-- | src/opengl/gl2paintengineex/qglengineshadersource_p.h | 6 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 37 | ||||
-rw-r--r-- | src/opengl/opengl.pro | 14 | ||||
-rw-r--r-- | src/opengl/qgl.cpp | 10 | ||||
-rw-r--r-- | src/opengl/qglcolormap.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qglframebufferobject.cpp | 6 | ||||
-rw-r--r-- | src/opengl/qglpixelbuffer.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qglshaderprogram.cpp | 2 |
8 files changed, 54 insertions, 25 deletions
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index b0b91ae..c80d6e1 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -73,8 +73,8 @@ static const char* const qglslMainVertexShader = "\ }"; static const char* const qglslMainWithTexCoordsVertexShader = "\ - attribute lowp vec2 textureCoordArray; \ - varying lowp vec2 textureCoords; \ + attribute mediump vec2 textureCoordArray; \ + varying mediump vec2 textureCoords; \ uniform highp float depth;\ void setPosition();\ void main(void) \ @@ -284,7 +284,7 @@ static const char* const qglslSolidBrushSrcFragmentShader = "\ }"; static const char* const qglslImageSrcFragmentShader = "\ - varying highp vec2 textureCoords; \ + varying mediump vec2 textureCoords; \ uniform sampler2D imageTexture; \ lowp vec4 srcPixel() { \ return texture2D(imageTexture, textureCoords); \ diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 4e8a97b..5906467 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -75,6 +75,7 @@ #include <private/qfontengine_p.h> #include <private/qtextureglyphcache_p.h> #include <private/qpixmapdata_gl_p.h> +#include <private/qdatabuffer_p.h> #include "qglgradientcache_p.h" #include "qglengineshadermanager_p.h" @@ -175,7 +176,7 @@ void QGLTextureGlyphCache::createTextureData(int width, int height) m_height = height; QVarLengthArray<uchar> data(width * height); - for (int i = 0; i < width * height; ++i) + for (int i = 0; i < data.size(); ++i) data[i] = 0; if (m_type == QFontEngineGlyphCache::Raster_RGBMask) @@ -200,13 +201,18 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_fbo); - GLuint colorBuffer; - glGenRenderbuffers(1, &colorBuffer); - glBindRenderbuffer(GL_RENDERBUFFER_EXT, colorBuffer); - glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_RGBA, oldWidth, oldHeight); - glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, - GL_RENDERBUFFER_EXT, colorBuffer); - glBindRenderbuffer(GL_RENDERBUFFER_EXT, 0); + GLuint tmp_texture; + glGenTextures(1, &tmp_texture); + glBindTexture(GL_TEXTURE_2D, tmp_texture); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, oldWidth, oldHeight, 0, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glBindTexture(GL_TEXTURE_2D, 0); + glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, + GL_TEXTURE_2D, tmp_texture, 0); glActiveTexture(GL_TEXTURE0 + QT_IMAGE_TEXTURE_UNIT); glBindTexture(GL_TEXTURE_2D, oldTexture); @@ -237,11 +243,24 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height) glDisableVertexAttribArray(QT_TEXTURE_COORDS_ATTR); glBindTexture(GL_TEXTURE_2D, m_texture); + +#ifdef QT_OPENGL_ES_2 + QDataBuffer<uchar> buffer(4*oldWidth*oldHeight); + glReadPixels(0, 0, oldWidth, oldHeight, GL_RGBA, GL_UNSIGNED_BYTE, buffer.data()); + + // do an in-place conversion from GL_RGBA to GL_ALPHA + for (int i=0; i<oldWidth*oldHeight; ++i) + buffer.data()[i] = buffer.at(4*i + 3); + + glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, oldWidth, oldHeight, + GL_ALPHA, GL_UNSIGNED_BYTE, buffer.data()); +#else glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, oldWidth, oldHeight); +#endif glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_RENDERBUFFER_EXT, 0); - glDeleteRenderbuffers(1, &colorBuffer); + glDeleteTextures(1, &tmp_texture); glDeleteTextures(1, &oldTexture); glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo); diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro index 868484e..4231721 100644 --- a/src/opengl/opengl.pro +++ b/src/opengl/opengl.pro @@ -73,16 +73,26 @@ x11 { } contains(QT_CONFIG, fontconfig) { + contains(QT_CONFIG, system-freetype) { + embedded:CONFIG += opentype + # pull in the proper freetype2 include directory include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) + LIBS_PRIVATE += -lfreetype + } else { + ### Note: how does this compile with a non-system freetype? + # This probably doesn't compile + } } else { DEFINES *= QT_NO_FREETYPE } + + LIBS_PRIVATE += $$QMAKE_LIBS_DYNLOAD } mac { OBJECTIVE_SOURCES += qgl_mac.mm \ qglpixelbuffer_mac.mm - LIBS += -framework AppKit + LIBS_PRIVATE += -framework AppKit -framework Carbon } win32:!wince*: { SOURCES += qgl_win.cpp \ @@ -131,5 +141,5 @@ wince*: { } } else { - QMAKE_LIBS += $$QMAKE_LIBS_OPENGL + LIBS_PRIVATE += $$QMAKE_LIBS_OPENGL } diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 0e60b01..f2a14d6 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -147,7 +147,7 @@ QGLSignalProxy *QGLSignalProxy::instance() \brief The QGL namespace specifies miscellaneous identifiers used in the Qt OpenGL module. - \ingroup multimedia + \ingroup painting-3D */ /*! @@ -190,7 +190,7 @@ QGLSignalProxy *QGLSignalProxy::instance() \brief The QGLFormat class specifies the display format of an OpenGL rendering context. - \ingroup multimedia + \ingroup painting-3D A display format has several characteristics: \list @@ -1554,7 +1554,7 @@ Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg() \class QGLContext \brief The QGLContext class encapsulates an OpenGL rendering context. - \ingroup multimedia + \ingroup painting-3D An OpenGL rendering context is a complete set of OpenGL state variables. The rendering context's \l {QGL::FormatOption} {format} @@ -2774,8 +2774,8 @@ const QGLContext* QGLContext::currentContext() \class QGLWidget \brief The QGLWidget class is a widget for rendering OpenGL graphics. - \ingroup multimedia - \mainclass + \ingroup painting-3D + QGLWidget provides functionality for displaying OpenGL graphics integrated into a Qt application. It is very simple to use. You diff --git a/src/opengl/qglcolormap.cpp b/src/opengl/qglcolormap.cpp index 0d38ce7..cdbf1c8 100644 --- a/src/opengl/qglcolormap.cpp +++ b/src/opengl/qglcolormap.cpp @@ -45,7 +45,7 @@ QGLWidgets. \module OpenGL - \ingroup multimedia + \ingroup painting-3D \ingroup shared QGLColormap provides a platform independent way of specifying and diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index c446112..52363cb 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -90,7 +90,7 @@ public: \since 4.6 - \ingroup multimedia + \ingroup painting-3D A framebuffer object has several characteristics: \list @@ -275,7 +275,6 @@ public: GLenum target; QSize size; QGLFramebufferObjectFormat format; - int samples; uint valid : 1; uint bound : 1; QGLFramebufferObject::Attachment fbo_attachment; @@ -368,7 +367,6 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At valid = checkFramebufferStatus(); color_buffer = 0; - samples = 0; } else { GLint maxSamples; glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples); @@ -478,7 +476,7 @@ void QGLFramebufferObjectPrivate::init(const QSize &sz, QGLFramebufferObject::At \brief The QGLFramebufferObject class encapsulates an OpenGL framebuffer object. \since 4.2 - \ingroup multimedia + \ingroup painting-3D The QGLFramebufferObject class encapsulates an OpenGL framebuffer object, defined by the \c{GL_EXT_framebuffer_object} extension. In diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index 60cb8ba..2a2c005 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -44,7 +44,7 @@ \brief The QGLPixelBuffer class encapsulates an OpenGL pbuffer. \since 4.1 - \ingroup multimedia + \ingroup painting-3D Rendering into a pbuffer is normally done using full hardware acceleration. This can be significantly faster than rendering diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index e3627ff..f8bffd3 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -55,6 +55,7 @@ QT_BEGIN_NAMESPACE \class QGLShaderProgram \brief The QGLShaderProgram class allows OpenGL shader programs to be linked and used. \since 4.6 + \ingroup painting-3D \section1 Introduction @@ -181,6 +182,7 @@ QT_BEGIN_NAMESPACE \class QGLShader \brief The QGLShader class allows OpenGL shaders to be compiled. \since 4.6 + \ingroup painting-3D This class supports shaders written in the OpenGL Shading Language (GLSL) and in the OpenGL/ES Shading Language (GLSL/ES). |