PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Writing pixels directly to memory - newb problem :)

Hey everyone.

Having some slight difficulty coding a fill triangle function using the buffer memory. I've got the code down which actually fills each triangle and that works fine, except that the color is all screwed. I've tried converting my colors to 565 manually and using ColorrefToNative() but it always comes out wrong. For example I tried creating a basic green, RGB(0,255,0), but this comes out red.

Heres the code which fills in part of the triangle...

Code:
memset((WORD*)dest_addr+(unsigned int)xs,
mColor,(unsigned int)((int)xe-(int)xs+1) * 2);


This is the result of much blind submitting of values but I got it working like I say, except for the color.

Does anyone have any clue what I'm talking about? not sure if i do :P

Any help on this would be greatly appreciated :)

Thanks,
Tom