[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Slick Forums • View topic - [ADDED] Newest PNGDecoder of Matthias Mann part of Slick now

Slick Forums

Discuss the Slick 2D Library
It is currently Thu Jul 29, 2021 5:24 pm

All times are UTC




Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu Mar 01, 2012 1:50 pm 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
I replaced the old PNGDecoder with the newest version from Matthias.
I also fixed PNGImageData to use the enums from PNGDecoder.
First testcases are working.

I'm unsure if PNGImageData could be enhanced now to support transparent stuff (currently marked as dead code in Eclipse). I'm too inexperienced here. If some Image expert might take a look that would be great :wink:

_________________
|
| |


Top
 Profile  
 
PostPosted: Thu Mar 01, 2012 5:32 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Wicked.

On a similar note, Nitram has a really great patch for grayscale textures in the BUG forum. It makes significant changes to the various ImageData/InternalTextureLoader/etc. classes but I think it may be worth it.

Here are the formats that Slick supports:
RGB is stored as (r, g, b, 1) -- 3 bytes per pixel -- 196,608 bytes for a 256x256 image
RGBA is stored as (r, g, b, a) -- 4 bytes per pixel -- 262,144 bytes for a 256x256 image

Slick will usually default to RGBA, unless you've specifically exported the PNG file with no alpha.

But if we know a texture is grayscale, then we can take advantage of GL's "internalFormat" to reduce the memory footprint by quite a lot. Not only is the texture going to be three/four times smaller, but it should also render a bit faster. If we are making a game like Limbo, where everything is in black and white, this becomes pretty significant.

Here is a breakdown of some other formats that IMO slick should support, via Nitram's patch:
LUMINANCE (grayscale) is stored as (L, L, L, 1) -- 1 byte per pixel -- 65,536 bytes for a 256x256 image
LUMINANCE_ALPHA (grayscale w/ alpha) is stored as (L, L, L, a) -- 2 bytes per pixel -- 131,072 bytes for a 256x256 image
ALPHA (only alpha texture) is stored as (0, 0, 0, a) -- 1 byte per pixel
INTENSITY is stored as (I, I, I, I) -- 1 byte per pixel


Top
 Profile  
 
PostPosted: Thu Mar 01, 2012 7:14 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
PostPosted: Thu Mar 01, 2012 8:17 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Yup, this means that the new PNG decoder now supports a wider range of PNG formats (i.e. if you save your PNG file as grayscale, then Slick will be able to load it).

This doesn't address the internal storage issue with OpenGL, though, since Slick's texture loader currently only stores image data in RGB or RGBA format. So there is no currently no benefit in exporting your PNG files as grayscale.


Top
 Profile  
 
PostPosted: Thu Mar 01, 2012 9:06 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
Oh, I see

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
PostPosted: Thu Mar 01, 2012 10:44 pm 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
Okay, so if I understand davedes right, we should add Nitram's patch (which was the main reason I added the new PNGDecoder) to the source code.

Does anyone already know how those patch files can be applied?

_________________
|
| |


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 7:16 am 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
The patch I applied is layed out to work within the Java 1.4 level. It can be done better in Java 1.6 and as the level was changed I'd like to rework this patch before its applied.

If the patch file is not the ideal way of submitting such changes, please tell me how I shall send you the changes.

Nitram


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 10:19 am 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
Hi Nitram,
great that you want to rework your patch to fit Java 6!

I just found some instructions to apply patch files from within Eclipse so I'll give it a try as soon as your patch is ready :D

Thanks for your support!

Cheers,
Tommy

_________________
|
| |


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 5:22 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
I send you a pull request in bitbucket. That should be the easiest way to get the things done.

Nitram


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 5:23 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
??

"You have received a notification from Martin Karing.
You no longer have access to the source of slick."

lol


Top
 Profile  
 
PostPosted: Sat Mar 03, 2012 5:30 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Yeah sorry about that. I had to test a few things with bit bucket before I got things going. That resulted in me forking the main slick repository with inheriting the rights. A little later I erased this repository again (this is where you got this message) because I made some mistakes, and forked it again.

Nitram


Top
 Profile  
 
PostPosted: Sun Mar 04, 2012 3:25 pm 
Offline
Game Developer

Joined: Sun Nov 12, 2006 11:18 pm
Posts: 890
Location: Germany
The pull request is added to the development branch now.

Nitram, it would be great if you also could provide a little test case :wink:

_________________
|
| |


Top
 Profile  
 
PostPosted: Sun Mar 04, 2012 8:44 pm 
Offline
Regular

Joined: Sun Oct 30, 2011 4:47 pm
Posts: 184
Location: Mittweida, Saxony, Germany
Alright. There is no test utility in use like JUnit, is there?
If not I will simply write a small kind of "demo" that uses the added abilities.

Nitram


Top
 Profile  
 
PostPosted: Sun Mar 04, 2012 8:46 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
No, as far as I'm aware there is no JUnit testing. Just small demos that users will be able to look to for code examples.


Top
 Profile  
 
PostPosted: Sun Mar 04, 2012 10:29 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
What about including ALPHA and INTENSITY along with the other default Format enums? :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 24 posts ]  Go to page 1, 2  Next

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:  
Powered by phpBB® Forum Software © phpBB Group