Login  Register

Re: Premultiplied Textures

Posted by Sven Gothel on Aug 02, 2012; 7:15am
URL: https://forum.jogamp.org/Premultiplied-Textures-tp4025659p4025729.html

On 07/29/2012 11:19 PM, Sebastian Greif [via jogamp] wrote:

> I thought that jogl uses premultiplied alpha for textures as default.
> It always does in the past.
> When i load a texture with alpha values with the TextureIO of jogl it
> transforms the texture to be premultiplied as default in the past.
> Take a look at the javadoc at
> http://jogamp.org/deployment/jogamp-next/javadoc/jogl/javadoc/com/jogamp/opengl/util/texture/Texture.html
>
> "To make things easier for developers, the Texture class will automatically
> convert non-premultiplied image data into premultiplied data when storing it
> into an OpenGL texture."
>
> Or is this not true anymore?
> I have simple png images which alpha channel e.g. to mask round corners.
> In the past i always setup blending equation to match premultiplied alpha
> textures. But in the new version this does not work anymore.
> So does jogl changes the way it loads the textures?
PNG images are now loaded using PNGJ, which does not depend on AWT anymore.

In case the image contains alpha, the resulting Texture is in RGBA mode,
not per-multiplied, since this would disallow proper GL usage here w/ other
normal RGBA sources.

Even though this might be a regression compared to previous AWT behavior
of loading PNG images _and_ the documentation, this IMHO is the way it should be.
Using OpenGL >= 2.0 and OpenGL ES 2.0, RGBA pixel format is usually the default.

Pls. add a bug report and we will fix the documentation in this regard.

AFAIK (while reading / modding code) other formats like TGA etc will
provide an RGBA Texture as well if the source is RGBA.

~Sven


signature.asc (910 bytes) Download Attachment