From d622f5db9a81959227145603643a89208d77f611 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 14 Sep 2009 09:18:34 +1000 Subject: qdoc: qglColor() doesn't work under OpenGL/ES 2.0 --- src/opengl/qgl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index fcb3510..f388cd5 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -3970,6 +3970,8 @@ void QGLWidget::glDraw() Calls glColor4 (in RGBA mode) or glIndex (in color-index mode) with the color \a c. Applies to this widgets GL context. + \note This function is not supported on OpenGL/ES 2.0 systems. + \sa qglClearColor(), QGLContext::currentContext(), QColor */ @@ -3993,6 +3995,8 @@ void QGLWidget::qglColor(const QColor& c) const glIndexi(ctx->colorIndex(c)); } #endif //QT_OPENGL_ES +#else + Q_UNUSED(c); #endif //QT_OPENGL_ES_2 } -- cgit v0.12 From 6b401a8f426c089714c656b2ccfd334d3cbe3280 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 14 Sep 2009 09:23:49 +1000 Subject: QGLWidget::fontDisplayListBase() is not supported under OpenGL/ES Update documentation and #ifdef out the implementation. Reviewed-by: trustme --- src/opengl/qgl.cpp | 10 ++++++++-- src/opengl/qgl_p.h | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index f388cd5..e545c2c 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -4113,9 +4113,12 @@ QImage QGLWidget::convertToGLFormat(const QImage& img) the characters in the given \a font. \a listBase indicates the base value used when generating the display lists for the font. The default value is 2000. + + \note This function is not supported on OpenGL/ES systems. */ int QGLWidget::fontDisplayListBase(const QFont & font, int listBase) { +#ifndef QT_OPENGL_ES Q_D(QGLWidget); int base; @@ -4133,9 +4136,7 @@ int QGLWidget::fontDisplayListBase(const QFont & font, int listBase) QString color_key; if (font.styleStrategy() != QFont::NoAntialias) { GLfloat color[4]; -#ifndef QT_OPENGL_ES glGetFloatv(GL_CURRENT_COLOR, color); -#endif color_key.sprintf("%f_%f_%f",color[0], color[1], color[2]); } QString key = font.key() + color_key + QString::number((int) regenerate); @@ -4158,6 +4159,11 @@ int QGLWidget::fontDisplayListBase(const QFont & font, int listBase) base = maxBase; } return base; +#else // QT_OPENGL_ES + Q_UNUSED(font); + Q_UNUSED(listBase); + return 0; +#endif } #ifndef QT_OPENGL_ES diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index fdd28a4..57b40fb 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -196,7 +196,9 @@ public: bool autoSwap; QGLColormap cmap; +#ifndef QT_OPENGL_ES QMap displayListCache; +#endif bool disable_clear_on_painter_begin; -- cgit v0.12 From dcbafc17a0fff2a7de7d4eb61e7fd665e59aae18 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 14 Sep 2009 09:38:26 +1000 Subject: qdoc: document default values for QGLFramebufferObject properties --- src/opengl/qglframebufferobject.cpp | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 81f2aa9..4b8a67e 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -120,6 +120,7 @@ void QGLFramebufferObjectFormat::detach() By default the format specifies a non-multisample framebuffer object with no attachments, texture target \c GL_TEXTURE_2D, and internal format \c GL_RGBA8. + On OpenGL/ES systems, the default internal format is \c GL_RGBA. \sa samples(), attachment(), target(), internalTextureFormat() */ @@ -165,8 +166,8 @@ QGLFramebufferObjectFormat::~QGLFramebufferObjectFormat() /*! Sets the number of samples per pixel for a multisample framebuffer object - to \a samples. - A sample count of 0 represents a regular non-multisample framebuffer object. + to \a samples. The default sample count of 0 represents a regular + non-multisample framebuffer object. If the desired amount of samples per pixel is not supported by the hardware then the maximum number of samples per pixel will be used. Note that @@ -185,6 +186,7 @@ void QGLFramebufferObjectFormat::setSamples(int samples) /*! Returns the number of samples per pixel if a framebuffer object is a multisample framebuffer object. Otherwise, returns 0. + The default value is 0. \sa setSamples() */ @@ -205,8 +207,8 @@ void QGLFramebufferObjectFormat::setAttachment(QGLFramebufferObject::Attachment } /*! - Returns the status of the depth and stencil buffers attached to - a framebuffer object. + Returns the configuration of the depth and stencil buffers attached to + a framebuffer object. The default is QGLFramebufferObject::NoAttachment. \sa setAttachment() */ @@ -229,7 +231,8 @@ void QGLFramebufferObjectFormat::setTextureTarget(GLenum target) /*! Returns the texture target of the texture attached to a framebuffer object. - Ignored for multisample framebuffer objects. + Ignored for multisample framebuffer objects. The default is + \c GL_TEXTURE_2D. \sa setTextureTarget(), samples() */ @@ -253,7 +256,9 @@ void QGLFramebufferObjectFormat::setInternalTextureFormat(GLenum internalTexture /*! Returns the internal format of a framebuffer object's texture or - multisample framebuffer object's color buffer. + multisample framebuffer object's color buffer. The default is + \c GL_RGBA8 on desktop OpenGL systems, and \c GL_RGBA on + OpenGL/ES systems. \sa setInternalTextureFormat() */ @@ -641,7 +646,8 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, By default, no depth and stencil buffers are attached. This behavior can be toggled using one of the overloaded constructors. - The default internal texture format is \c GL_RGBA8. + The default internal texture format is \c GL_RGBA8 for desktop + OpenGL, and \c GL_RGBA for OpenGL/ES. It is important that you have a current GL context set when creating the QGLFramebufferObject, otherwise the initialization @@ -727,7 +733,8 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, QMacCompatGLen The \a attachment parameter describes the depth/stencil buffer configuration, \a target the texture target and \a internal_format the internal texture format. The default texture target is \c - GL_TEXTURE_2D, while the default internal format is \c GL_RGBA8. + GL_TEXTURE_2D, while the default internal format is \c GL_RGBA8 + for desktop OpenGL and \c GL_RGBA for OpenGL/ES. \sa size(), texture(), attachment() */ @@ -758,7 +765,8 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, Attachment att The \a attachment parameter describes the depth/stencil buffer configuration, \a target the texture target and \a internal_format the internal texture format. The default texture target is \c - GL_TEXTURE_2D, while the default internal format is \c GL_RGBA8. + GL_TEXTURE_2D, while the default internal format is \c GL_RGBA8 + for desktop OpenGL and \c GL_RGBA for OpenGL/ES. \sa size(), texture(), attachment() */ -- cgit v0.12 From ed5588f6e9ab11d61fb770eb76509a33962cf571 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 14 Sep 2009 09:43:40 +1000 Subject: qdoc: QGLWidgets -> QGLWidget, etc, for proper doc linking. --- src/opengl/qgl.cpp | 20 ++++++++++---------- src/opengl/qglcolormap.cpp | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e545c2c..bd9b5a5 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -228,7 +228,7 @@ bool qt_gl_preferGL2Engine() \since 4.6 Sets the preferred OpenGL paint engine that is used to draw onto - QGLWidgets, QGLPixelBuffers and QGLFrameBufferObjects with QPainter + QGLWidget, QGLPixelBuffer and QGLFramebufferObject targets with QPainter in Qt. The \a engineType parameter specifies which of the GL engines to @@ -1265,8 +1265,8 @@ QGLFormat::OpenGLVersionFlags QGLFormat::openGLVersionFlags() /*! - Returns the default QGLFormat for the application. All QGLWidgets - that are created use this format unless another format is + Returns the default QGLFormat for the application. All QGLWidget + objects that are created use this format unless another format is specified, e.g. when they are constructed. If no special default format has been set using @@ -1353,7 +1353,7 @@ void QGLFormat::setDefaultOverlayFormat(const QGLFormat &f) /*! - Returns true if all the options of the two QGLFormats are equal; + Returns true if all the options of the two QGLFormat objects are equal; otherwise returns false. */ @@ -1371,7 +1371,7 @@ bool operator==(const QGLFormat& a, const QGLFormat& b) /*! - Returns false if all the options of the two QGLFormats are equal; + Returns false if all the options of the two QGLFormat objects are equal; otherwise returns true. */ @@ -3100,7 +3100,7 @@ const QGLContext* QGLContext::currentContext() QGLFormat format\endlink and you can also create widgets with customized rendering \link QGLContext contexts\endlink. - You can also share OpenGL display lists between QGLWidgets (see + You can also share OpenGL display lists between QGLWidget objects (see the documentation of the QGLWidget constructors for details). Note that under Windows, the QGLContext belonging to a QGLWidget @@ -3382,7 +3382,7 @@ bool QGLWidget::isValid() const Returns true if this widget's GL context is shared with another GL context, otherwise false is returned. Context sharing might not be - possible if the QGLWidgets use different formats. + possible if the widgets use different formats. \sa format() */ @@ -3480,7 +3480,7 @@ void QGLWidget::swapBuffers() resizeGL() or paintGL(). This method will try to keep display list and texture object sharing - in effect with other QGLWidgets, but changing the format might make + in effect with other QGLWidget objects, but changing the format might make sharing impossible. Use isSharing() to see if sharing is still in effect. @@ -3784,7 +3784,7 @@ void QGLWidget::paintEvent(QPaintEvent *) /*! Renders the current scene on a pixmap and returns the pixmap. - You can use this method on both visible and invisible QGLWidgets. + You can use this method on both visible and invisible QGLWidget objects. This method will create a pixmap and a temporary QGLContext to render on the pixmap. It will then call initializeGL(), @@ -4866,7 +4866,7 @@ QGLContextResource::~QGLContextResource() if (m_resources.size()) { qWarning("QtOpenGL: Resources are still available at program shutdown.\n" " This is possibly caused by a leaked QGLWidget, \n" - " QGLFrameBufferObject or QGLPixelBuffer."); + " QGLFramebufferObject or QGLPixelBuffer."); } #endif } diff --git a/src/opengl/qglcolormap.cpp b/src/opengl/qglcolormap.cpp index 7edb250..edb5c4f 100644 --- a/src/opengl/qglcolormap.cpp +++ b/src/opengl/qglcolormap.cpp @@ -42,14 +42,14 @@ /*! \class QGLColormap \brief The QGLColormap class is used for installing custom colormaps into - QGLWidgets. + a QGLWidget. \module OpenGL \ingroup painting-3D \ingroup shared QGLColormap provides a platform independent way of specifying and - installing indexed colormaps into QGLWidgets. QGLColormap is + installing indexed colormaps for a QGLWidget. QGLColormap is especially useful when using the OpenGL color-index mode. Under X11 you must use an X server that supports either a \c -- cgit v0.12 From 822f979f4398bb364de34a07bfbaa4ade93502db Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 14 Sep 2009 10:01:34 +1000 Subject: qdoc: QGLFormat documentation improvements --- src/opengl/qgl.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index bd9b5a5..1bcfab8 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -271,7 +271,7 @@ void QGL::setPreferredPaintEngine(QPaintEngine::Type engineType) \i \link setStereo() Stereo buffers.\endlink \i \link setDirectRendering() Direct rendering.\endlink \i \link setOverlay() Presence of an overlay.\endlink - \i \link setPlane() The plane of an overlay format.\endlink + \i \link setPlane() Plane of an overlay.\endlink \i \link setSampleBuffers() Multisample buffers.\endlink \endlist @@ -1353,8 +1353,10 @@ void QGLFormat::setDefaultOverlayFormat(const QGLFormat &f) /*! - Returns true if all the options of the two QGLFormat objects are equal; - otherwise returns false. + Returns true if all the options of the two QGLFormat objects + \a a and \a b are equal; otherwise returns false. + + \relates QGLFormat */ bool operator==(const QGLFormat& a, const QGLFormat& b) @@ -1371,8 +1373,10 @@ bool operator==(const QGLFormat& a, const QGLFormat& b) /*! - Returns false if all the options of the two QGLFormat objects are equal; - otherwise returns true. + Returns false if all the options of the two QGLFormat objects + \a a and \a b are equal; otherwise returns true. + + \relates QGLFormat */ bool operator!=(const QGLFormat& a, const QGLFormat& b) -- cgit v0.12 From c151b747e0d7b45e0c7d5de6964b9dfef207d833 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 14 Sep 2009 10:10:58 +1000 Subject: qdoc: size of a QGLColormap is 256 on all platforms, not just Windows --- src/opengl/qglcolormap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qglcolormap.cpp b/src/opengl/qglcolormap.cpp index edb5c4f..b86f9e0 100644 --- a/src/opengl/qglcolormap.cpp +++ b/src/opengl/qglcolormap.cpp @@ -61,7 +61,7 @@ least a \c PseudoColor visual. Note that you may experience colormap flashing if your X server is running in 8 bit mode. - Under Windows the size of the colormap is always set to 256 + The size() of the colormap is always set to 256 colors. Note that under Windows you can also install colormaps in child widgets. -- cgit v0.12