- Joined
- Jul 21, 2007
- Messages
- 3,227
- Trophies
- 1
- Age
- 43
- Location
- somewhere
- Website
- spinalcode.co.uk
- XP
- 3,398
- Country
Can someone clue me into how the hell the pixel buffer works? I can either get the colours correct, OR the x,y location, not both. I'm attempting to use --
on the upper screen with console output on the lower screen. However, the pixels are spaced out. If I *2 instead of *3, then the pixels are in the correct place, but the rgb values are wrong.
Little help?
Cheers.
Code:
void drawPixel(int x, int y, char r, char g, char b, u8* screen)
{
int height=240;
u32 v=((239-y)+x*height)*3;
screen[v]=b;
screen[v+1]=g;
screen[v+2]=r;
}
on the upper screen with console output on the lower screen. However, the pixels are spaced out. If I *2 instead of *3, then the pixels are in the correct place, but the rgb values are wrong.
Little help?
Cheers.