paul_nicholls
Still Fresh
- Joined
- Nov 23, 2006
- Messages
- 42
Hi all,
I am experimenting (using freepascal) with writing to the gp2x frame buffer (/dev/fb0) directly to see if I can speed up some graphics I was doing.
I am opening up the frame buffer device using the Open() function:
CODE
fb := Open('/dev/fb0', O_RDWR);
I am then mapping memory like so (assuming 320 by 240, 16bit):
CODE
FMemData := MMap(Nil, 320 * 240 *2, PROT_WRITE, MAP_SHARED, fb,0);
When I draw pixels, etc, I write to the mapped memory by taking the FMemData pointer, offsetting by
CODE
(x * 2) + 320 * 2 * y
and storing the 565 formatted pixel at that location.
This works, but I can barely see the result...the output is very, very faint...
Can anyone think of why the output would be so faint?
As I am not using SDL to create a window and draw the graphics, could perhaps the backlight be off when doing this?
cheers,
Paul.
I am experimenting (using freepascal) with writing to the gp2x frame buffer (/dev/fb0) directly to see if I can speed up some graphics I was doing.
I am opening up the frame buffer device using the Open() function:
CODE
fb := Open('/dev/fb0', O_RDWR);
I am then mapping memory like so (assuming 320 by 240, 16bit):
CODE
FMemData := MMap(Nil, 320 * 240 *2, PROT_WRITE, MAP_SHARED, fb,0);
When I draw pixels, etc, I write to the mapped memory by taking the FMemData pointer, offsetting by
CODE
(x * 2) + 320 * 2 * y
and storing the 565 formatted pixel at that location.
This works, but I can barely see the result...the output is very, very faint...
Can anyone think of why the output would be so faint?
As I am not using SDL to create a window and draw the graphics, could perhaps the backlight be off when doing this?
cheers,
Paul.