Qt-interest Archive, August 2006
Pb with bindTexture()
Message 1 in thread
This one took me a while to figure out. I am glad Qt is open source ;-),
I would not have found without digging the .cpp
I am using a QImage with format Format_ARGB_Premultiplied. This image is
binded as an OpenGL texture using QGLWidget::bindTexture.
Unfortunately, doing so, the image is converted to Format_ARGB (line
1255 of qgl.cpp in Qt4.1.4). Thus, the texture is no longer
premultiplied. This is a problem because the proper way to do blending
in OpenGL is to use premultiplied texture and
glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA) (not
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA as written in many places).
I cannot see any reason why this conversion is done? Can the Trolls
comment on this? At least, it should be mentionned in the documentation
(BTW, with Qt 4..x.x, the documentation is less complete and detailed
than it used to be, is there a web site/url to suggest missing info?)
--
[ signature omitted ]
Message 2 in thread
On Tuesday 01 August 2006 22:01, Xavier Décoret wrote:
> This one took me a while to figure out. I am glad Qt is open source ;-),
> I would not have found without digging the .cpp
>
> I am using a QImage with format Format_ARGB_Premultiplied. This image is
> binded as an OpenGL texture using QGLWidget::bindTexture.
> Unfortunately, doing so, the image is converted to Format_ARGB (line
> 1255 of qgl.cpp in Qt4.1.4). Thus, the texture is no longer
> premultiplied. This is a problem because the proper way to do blending
> in OpenGL is to use premultiplied texture and
> glBlendFunc(GL_ONE,GL_ONE_MINUS_SRC_ALPHA) (not
> glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA as written in many places).
>
> I cannot see any reason why this conversion is done? Can the Trolls
> comment on this? At least, it should be mentionned in the documentation
> (BTW, with Qt 4..x.x, the documentation is less complete and detailed
> than it used to be, is there a web site/url to suggest missing info?)
That sounds indeed like a bug. Textures should IMO always be premultiplied.
We'll have a look at it :)
Missing information in the documentation is a bug, just as wrong functionality
in the library is. So feel free to send a mail to qt-bugs about it.
Cheers,
Lars
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/
--
[ signature omitted ]