GP32 16 Bit pixel manipiulation


Nitro

Member
Joined
Jan 22, 2003
Messages
172
I've been trying to do some graphics manipulation (always been my favorite) in 16 bit mode on the GP32. I've had no problem doing this in 8 bit mode, as each pixel is represented by 1 byte, but I can't quite get my head around 16 bit.
As far as I understand each pixel is represented by 2 bytes, but I've tried writting a loop which fills the screen with a specified colour, and I haven't had much luck. All I got was half the screen filled with a colour, so I realised that each pixel was 2 bytes wide and I tried multiplying the buffer index by 2. I was quite happy to see that the entire screen was fileld this time, but then I noticed that it was the incorrect colour <_<

Can anyone please explain to me how to write pixels to a 16 bit screen in the correct colours? Before I multiplyed the buffer index, the colour was correct. but of course only half of the screen was filled ;)

I'm currently using "unsigned char *screen" as the pointer to the surface buffer, is that okay ?

Any help is appreciated. Thank you!
 
i'd use a unsigned short* buffer instead..
and the colors are arranged like this 5:5:5:1
which means, 5 bits RED, 5 bits GREEN, 5 bits BLUE and then one last bit.. which i dunno what does (if anything)


i think the LCD controller is capable of 5:6:5 color aswell.

---
mithris
 
Thanks, it works now :D
I'd tried doing that before, but the compiler told me that it was an incompatible type, and that kinda made sense to me, so I never bothered testing it! Stupid me... ;P

Thanks for your help!
 
I wouldn't use the last bit as a flag - since according to the docs its a brightness swtich : 0=Bright 1=Normal
 
Back
Top