Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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. |
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
it looks like you can't turn off pre-multiplying in JOGL... am I wrong?
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
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. 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 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Administrator
|
In reply to this post by Robert
On 07/17/2013 12:09 AM, Sven Gothel wrote:
> > 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. I do not see AWTTextureIO/AWTTextureData premultiplying the data, it keeps the alpha channels intact AFAIK, see 'hasAlpha' in latter class. AFAIK I have seen this proper behavior in our unit tests as well.. However, I still recommend using the default TextureIO impl. ~Sven |
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
The reason I'm using AWTTextureIO is that I'm passing a BufferedImage that I did not load in from a file (I created the image in my application and shouldn't have to save it to file in order to create an OpenGL texture). TextureIO does not have the option of passing a BufferedImage. What method do you suggest? I don't have to use a BufferedImage specifically, but it would be convenient.
|
Loading... |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
this worked:
ByteArrayOutputStream os = new ByteArrayOutputStream(); ImageIO.write(bufferedImage, "png", os); InputStream is = new ByteArrayInputStream(os.toByteArray()); TextureData td = TextureIO.newTextureData(gl.getGLProfile(),is, config.useMipMaps, "png"); Thanks for your help! |
Free forum by Nabble | Edit this page |