[Interest] Quick3D mapping of png textures onto Item 3D

Till Oliver Knoll till.oliver.knoll at gmail.com
Tue Sep 18 08:57:55 CEST 2012


2012/9/18 Satya Praveen Ganapathi <praveen.s at hmie.co.in>:
> ...
> However, the png image is not getting displayed properly in 3D space i.e.
> transparent area of the png file is
> shown as black shaded.

Most probably you simply need to enable "alpha blending": In OpenGL
terms that usually means

a) Turn blending on: glEnable(GL_BLEND)
b) Define a blend function, e.g.: glBlendFunc(GL_SRC_ALPHA,
GL_ONE_MINUS_SRC_ALPHA)

Note: "Premultiplied alpha" textures (refer to Wikipedia or the Qt
docs about the same topic) are to be preferred, in which case you
would say glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)

Here is a guy who is trying /exactly/ the same thing as you:

  http://galfar.vevb.net/imaging/smf/index.php?topic=296.0

Depending on what you are trying to achieve the function glTexEnv()
with argument GL_BLEND might be useful too (if you want to apply alpha
blending at the moment when applying the texture - and if you want
that the underlying surface colour shines through). Refer to the
(possibly outdated) FAQ:

  http://www.opengl.org/archives/resources/faq/technical/transparency.htm


How you apply all this to Qt 3D I don't know - but I'm sure there must
be this big "Enable blending" switch somewhere, too - refer to the
docs (and if not, to my little understanding you can still mix in your
own "raw OpenGL" code as above, no?).

Cheers, Oliver



More information about the Interest mailing list