GP32 65536 Confusion


ThomasS

Still Fresh
Joined
Apr 8, 2003
Messages
22
(I searched the forum but didn't surprisingly find anything about that)
I always thought the GP32 has 65536 colours (it's even written on the gamepark package), but starting coding in 16 Bit mode I discovered that via the macro (from CHN's source code)

#define GP_RGB24(r,g,B) (((((r>>3))&0x1f)<<11)|((((g>>3))&0x1f)<<6)|((((b>>3))&0x1f)<<1))

you only get 5 bit for red, 5 bit for green, 5 bit for blue, the very first bit is unused (5-5-5-0 format).
That are only 2^15 = 32*32*32 = 32768 colours.
So I tried to verify and switched bit 0 on/off in a loop, but I couldn't see any difference in colour shade on my GP32.


Is CHN's macro wrong(actually it works quite good except for that possible 1 bit loss...) or what's the correct colour format?
 

Charge

Member
Joined
May 26, 2003
Messages
206
Age
44
Location
Croydon, England
The macro is correct, the last bit doesn't do anything so you only have 2^15 colours. You could use it yourself though, for some form of collision detection or somthing.
 

ZardozJones

Certified Guru
Joined
Jan 28, 2003
Messages
59
Hi

no - the bottom bit does affect colour - you can use it to brighten colours - or only on the green channel as usual. so the gp32 really does have 64k colours.
 

Arda

Member
Joined
Jul 16, 2003
Messages
142
Location
istanbul
Website
arda.kisafilm.org
Yes gp32 has 64K colours. if you set last bit to 1, colours get brighter.

and I'm happy that ZJ is showing up here lately, I hope he still works on gp32.
 

GiG

The mighty penguin cat
Joined
Jun 8, 2003
Messages
326
Age
45
Location
Venice - ITALY
Website
www.webalice.it
ThomasS posted on Mar 24 2004 at 06:15 PM said:
That are only 2^15 = 32*32*32 = 32768 colours.
Well, it is difficult (impossible) to give the same number of bits to each colour if you have 16bit and RGB codes :lol:
It would be possible with CMYK.

Anyway... "only" 32768 colours you say? What are you planning to make that needs more colours? I am curious :)
 
Last edited by a moderator:

ThomasS

Still Fresh
Joined
Apr 8, 2003
Messages
22
thx for clearing it up, but still 1 question:

so "brighten colours" means actually "brighten only the green channel" or "brighten all channels"? (if only the green channel is affected, r(5):g(5):b(5):g(1) would be a strange format, so I guess it brightens all colours...)

(... and I assume the difference won't be probably visible at all, so it's more or less a theoretical question...)
 

ZardozJones

Certified Guru
Joined
Jan 28, 2003
Messages
59
Hi

I think it means brighten all colours, and If I remember it's inverted so 1 = dark 0 = bright. The green thing I was talking about, just ment I only use it on the green channel for some trickery so just ignore that :)
 
Top