PNGPixelRect can only handle Lum/RGB/RGBA [1/3/4 bpp] images for now

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

PNGPixelRect can only handle Lum/RGB/RGBA [1/3/4 bpp] images for now

thefrog69
Hello,

I'm migrating to JOGL2 from JOGL1 and I have the following problem.

I load a PNG into a bufferedimage and then use it as a texture

BufferedImage thumbNail=ImageIO.read(new File(localPath+catalogPath+path + txtName));
AWTTextureIO.newTextureData(GLProfile.getDefault(),thumbNail, false));
And I get this exception.
java.lang.RuntimeException: PNGPixelRect can only handle Lum/RGB/RGBA [1/3/4 bpp] images for now. BytesPerPixel 8

Is there a Workaround ? I cannot resave all my PNGs
I did not have this problem in JOGL1

Thanks for your help
Reply | Threaded
Open this post in threaded view
|

Re: PNGPixelRect can only handle Lum/RGB/RGBA [1/3/4 bpp] images for now

gouessej
Administrator
Hi

You could modify the buffered image so that it uses a supported pixel format. Which kind of PNG do you use? "BytesPerPixel 8" is weird.

Edit.: You're probably using grayscale or truecolor PNGs with 2 bytes per sample. You can simply drop the least significant byte so that it uses 1 byte per sample, i.e 4 bytes per pixel which is supported by JOGL.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: PNGPixelRect can only handle Lum/RGB/RGBA [1/3/4 bpp] images for now

thefrog69
Thanks !
Reply | Threaded
Open this post in threaded view
|

Re: PNGPixelRect can only handle Lum/RGB/RGBA [1/3/4 bpp] images for now

gouessej
Administrator
You're welcome.
Julien Gouesse | Personal blog | Website