Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Image color depth & memory

Author
Message
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 10th Mar 2012 19:51 Edited at: 10th Mar 2012 20:03
Hello,

Depending on how AppGameKit handles OpenGL image loading ( opengl textures), i have one question :

Is a 8 bits PNG transparent image will use the same memory as a 32 bits transparent image (in AppGameKit Tier1) with mobile devices when it's loaded ? Or are your loading 8bits images as 32bits textures by default ?
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 10th Mar 2012 21:15
very interesting question
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Mar 2012 00:37
Interesting indeed...

As it may simply be the pixel resolution that affects the memory factor... guess we must await Lee?

kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 12th Mar 2012 12:46
My (good i hope) guess, basing off my knowledge (which is better in DX, but it may be the same in OpenGL) is:

8bits image isn't loaded as a 32bits texture. 30 bits would be loaded as 32 bits, but not:

4 bits, 8 bits, 16 bits, 32 bits, 64 bits, 128 bits, 256 bits, 512 bits and so on, because they're multipliers of 2 or so.

Basically, loading a 8 bits texture will take less memory than loading a 32 bits texture, both with transparency.


I think I'm right, but that'd need a verify.

Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 12th Mar 2012 18:37
Currently all images are stored as 32bit RGBA images in GPU memory. Any images that aren't a power 2 in size are scaled up to the nearest power of 2 internally on mobile devices.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 12th Mar 2012 21:55
All my graphics are 8bit!!
Could this be an optional extension to the LoadImage command in the future?
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 12th Mar 2012 23:00
There are formats for single channel (8 bit) greyscale, single channel alpha, or a 2 channel (16 bit) greyscale + alpha, but the smallest colour texture with alpha is the 4 channel (32 bit) RGBA.

Assuming the 1 and 2 channels textures behave with the new image manipulation commands, they are a possibility for the future.
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 13th Mar 2012 05:30 Edited at: 13th Mar 2012 05:42
For precision, in apple doc (iOS) :

(sorry the link tag doesn't work for this url lol)

http://developer.apple.com/library/ios/#documentation/3DDrawing/Conceptual/OpenGLES_ProgrammingGuide/TechniquesForWorkingWithTextureData/TechniquesForWorkingWithTextureData.html%23//apple_ref/doc/uid/TP40008793-CH104-SW1

Quote: "If your application cannot use compressed textures, consider using a lower precision pixel format. A texture in RGB565, RGBA5551, or RGBA4444 format uses half the memory of a texture in RGBA8888 format. Use RGBA8888 only when your application needs that level of quality."


the RGBA5551 format or the RGBA4444 format could be the solution in most of cases (RGBA5551 for non-gradient transparency .. which may be sufficient if we want to make a game with a lot of contents)

It could be great to have the possibility to specify it... i'm facing memory limits for my game ... and i don't need 24 bits colors all the time ... 15 bits is often sufficient for me

So... waiting for future image manipulation commands
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 13th Mar 2012 09:43
Same problem here MikeMax.
Having the option to specify either the bit depth or RGBA format with the LoadImage or CreatSprite commands would be great.
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 13th Mar 2012 15:52
Whilst OpenGL does support RGB565, looking at the OpenGL ES 1.1 spec for embedded devices it claims only GL_ALPHA, GL_RGB, GL_RGBA, GL_LUMINANCE, or GL_LUMINANCE_ALPHA are supported. If iOS supports it then it looks like some devices extend this spec to provide more formats, but unfortunately it isn't guaranteed to work across all devices.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 13th Mar 2012 15:59
ahhhh too bad

Login to post a reply

Server time is: 2024-11-23 05:17:47
Your offset time is: 2024-11-23 05:17:47