Re: How do I use 16-bpp surfaces?
In Reply to: How do I use 16-bpp surfaces? posted by Fredrik Andersson on January 14, 1998 at 13:53:09:
You are reading the pointer incorrectly. You should cast the surface pointer to a WORD instead of an unsigned char. Something like:
WORD *surface = (WORD *)SurfaceDesc.SurfacePtr
Also, you can't use the RGB macro outside of GDI. Here is an RGB macro that I use for 16bpp:
#define RGB2(r,g,b) ((WORD) ((BYTE) (r) << __SHIFT | (BYTE) (G) << 5 | (BYTE) (B)))
__SHIFT is 10 or 11 depending on your video card. Read the DDraw help topic on pixel bitmasks for more info. The major difference between 16bpp and 24bpp is that in 16 your RGB values can be a max of RGB(31,31,31), in 24bpp they can be RGB(255,255,255). Obviously, this is because 24bpp uses more memory. Again, read the DDraw pixel bitmask topic, it explains this fully.