Hello Guest

Noobie: PNG images

  • 5 Replies
  • 11773 Views
Noobie: PNG images
« on: June 15, 2003, 09:35:52 »
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

*

Offline princec

  • *****
  • 1932
    • Puppygames
Noobie: PNG images
« Reply #1 on: June 15, 2003, 10:01:41 »
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 :)

*

Offline Chman

  • ***
  • 100
    • http://www.shakebox.org
Noobie: PNG images
« Reply #2 on: June 15, 2003, 10:49:07 »
And don't forget that your image size must be a power of 2... like 64x64, 128x128 and so one...

Chman

*

Offline princec

  • *****
  • 1932
    • Puppygames
Noobie: PNG images
« Reply #3 on: June 15, 2003, 11:05:36 »
...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 :)

*

Offline oNyx

  • ***
  • 177
  • 弾幕
Noobie: PNG images
« Reply #4 on: June 15, 2003, 12:01:16 »
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 ;)

Noobie: PNG images
« Reply #5 on: June 15, 2003, 14:39:36 »
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