Slick Forums

Discuss the Slick 2D Library
It is currently Wed Oct 16, 2019 11:51 am

All times are UTC




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sun Oct 30, 2011 4:53 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Hello,

I am working at a project that involves loading a large number of grayscale textures stored as PNGs. Sadly the fast PNG loader and the texture loader are not able to handle such images and so they are converted to RGBA images by the very slow native Java image loader.

That is a state I really dislike and I got already a tested proposal on how to change this. Checkout my patch: >>> CLICK <<< :wink:

Based on the first tests this changes work smooth and fast. I hope you can use it.

Nitram
http://illarion.org


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 30, 2011 4:58 pm 
Offline
Oldbie
User avatar

Joined: Fri Jul 20, 2007 9:25 am
Posts: 410
Location: Croatia
awesome martin

does it use a single channel texture also?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Oct 30, 2011 5:36 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Supported texture formats after the patch:
  • 8x8x8x8bit - RGBA
  • 8x8x8x8bit - BGRA
  • 8x8x8bit - RGB
  • 8x8bit - Luminance (Greyscale) + Alpha
  • 8bit - Luminance (Greyscale)


All other formats are still supported how ever still need to be converted in the "smalltest" format that supports all image data.

Runtime created images are always in the RGBA format. TGA still only loads RGB and RGBA, since I do not know how the other formats are encoded.

The IIO-based PNG loader is able to use RGBA, RGB, Grayscale and Greyscale+Alpha to select the best fitting format for the conversion operation.

Nitram
http://illarion.org


Top
 Profile  
 
PostPosted: Tue Nov 15, 2011 5:50 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Who do I need to poke to get this patch considered to be added to the SVN state?

Nitram

_________________
http://illarion.org


Top
 Profile  
 
PostPosted: Sun Jan 15, 2012 5:51 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Now as Slick got a bunch of new developers I'd like to bump this patch once more into consideration.

Nitram

_________________
http://illarion.org


Top
 Profile  
 
PostPosted: Sun Jan 15, 2012 9:17 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
I want to point out that the PNGDecoder used in Slick is a cut down version of an early version of TWL PNGDecoder. And it also does a lot of unnecessary memory copies - so maybe instead of patching it to support a few more formats it should be replaced with the latest version which supports many more PNG formats.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Mon Jan 16, 2012 8:24 am 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
Good point, Matthias!
Does your current PNGLoader support the formats Nitram mentions? Or would you be willing to add them if not?

_________________
Right Angle Games | Marte Engine
Back to the past | Star Cleaner | SpiderTrap


Top
 Profile  
 
PostPosted: Mon Jan 16, 2012 1:49 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
This patch does not alter the PNG Decoder that is implemented in Slick. Updating this one to a later version can be done separated from this patch.

This patch does how ever use the ability of the PNG Decoder to load non-RGBA graphics and load those graphics as the best fitting OpenGL texture type. So currently if you put in a grayscale texture, the internal texture loader will reject the loaded data from the PNGDecoder and load the image using the IIO-based decoder. This decoder also converts any image to a RGBA image. The texture loader then loads the graphic that is now a RGBA texture for sure into OpenGL. My patch changes this behavior by adding the ability to Slick to load RGB, Grayscale-Alpha and Grayscale images directly into OpenGL.

Nitram

_________________
http://illarion.org


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 8:04 am 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Bump!

Anything?

_________________
http://illarion.org


Top
 Profile  
 
PostPosted: Wed Feb 01, 2012 6:40 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1242
Tommy wrote:
Good point, Matthias!
Does your current PNGLoader support the formats Nitram mentions? Or would you be willing to add them if not?

Yes, it supports all formats except 16bit per component or interlaced PNGs.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Fri Feb 03, 2012 8:42 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
As I said, my patch does not effect the PNGDecoder implementation in any what what so ever. It just improves the way Slick uses the information received from the PNGDecoder. If a old PNGDecoder is used or a updated one does not matter. How ever after all a updated one would surely be preferred ;)

Nitram

_________________
http://illarion.org


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group