Noobie: PNG images

Started by Backmask, June 15, 2003, 09:35:52

Previous topic - Next topic

Backmask

Hi

Another JGO refugee here. I recently had some time to start looking in to LWJGL and unfortunate the JGO shoutdown really had a bad timing as most of the knowledge around LWJGL lies there in the forum. And I know this question has been answered before there but unfortunate I can't search for the answer so I will take up some of your time instead (hey don't blame me, blame the misscommunication at SUN).

I have made some small examples in LWGJL with texture mapping. The images I been using is from the Nehe tutorials. These PNG images works fine but when I create my own images in Photoshop the just displays as white recatangles. I know I read somehere how you should create png images in Photoshop and how to load the in to LWJGL. Does anyone care to help me?

-----------------------------------------
Markus Backman
http://www.umeweb.com/backmask

princec

You need to have an alpha channel. This means you need to start with an RGB 24-bit image with transparent as the background colour (the checkerboard pattern).

If you don't want transparency then you need to specify GL.RGB instead of GL.RGBA when creating the texture in GL.

Cas :)

Chman

And don't forget that your image size must be a power of 2... like 64x64, 128x128 and so one...

Chman

princec

...but not square - it can be rectangular, which I only found out after quite a while! It's obvious really but the way it's said always seems to imply the textures have to be square.

Cas :)

oNyx

There is a tool called PNG Crush. It's a bruteforce tool wich checks what's the best way to squish the png to the smallest possible file. There are more than 100 different compression schemes for the png file format. Photoshop is known for not creating small pngs.

linkage
sourceforge:
http://pmt.sourceforge.net/pngcrush/
win port:
http://gnuwin32.sourceforge.net/packages/pngcrush.htm
win port d/l:
http://prdownloads.sourceforge.net/gnuwin32/pngcrush-1.5.10-bin.zip?download

And yes... textures usually have to be square with power of 2 proportions... however nvidia cards should support wrong proportions too. Well it's better to stick with power of 2 ;)

Backmask

Thanks all... got it to work now...

Will look in to the PNG Crush app but I think I am going to create my own image format but it can be worth looking at anyway.

----------------------------------------------
Markus Backman
http://www.umeweb.com/backmask