Login  Register

Re: AWTTextureIO premultiplying colors with alpha?

Posted by Sven Gothel on Jul 16, 2013; 10:09pm
URL: https://forum.jogamp.org/AWTTextureIO-premultiplying-colors-with-alpha-tp4029601p4029603.html

On 07/16/2013 09:37 PM, Robert [via jogamp] wrote:> Hi,

>
> I need to be able to create textures from BufferedImages but I'm running into
> this problem where the RGB components are premultiplied by the alpha
> component. This is not the behaviour I desire. This is the code I'm using:
>
>
>                 TextureData td =
> AWTTextureIO.newTextureData(gl.getGLProfile(),bi, config.useMipMaps);
>
> after this call when I check the byte array in the TextureData object, the RGB
> values have all been premultiplied.
Texture class does not alter the image data,
i.e. no premultiplication performed here.
I just have fixed the API doc .. (thx for kicking in this direction)
  <http://jogamp.org/git/?p=jogl.git;a=commitdiff;h=55e480cd487e3089fae9b836eb213cd7c6b3d79a>


AWTTextureIO uses AWT's image pipeline, which may perform this task.
It may also be possible that we do - I would need to verify this code.

Default is TextureIO, not the AWT specialization.
TextureIO uses our decoder for JPEG and PNG, both do _not_
perform any premultiplication.
Both also deliver the data in proper GL orientation,
and hence are more efficient!

On 07/16/2013 10:19 PM, Robert [via jogamp] wrote:
> it looks like you can't turn off pre-multiplying in JOGL... am I wrong?

.. use TextureIO ..

~Sven



signature.asc (911 bytes) Download Attachment