Advertisement

Color with Directx and 16-bit RGB

Started by May 30, 2001 11:59 PM
2 comments, last by JSCFaith 23 years, 8 months ago
Hey, I have a function called DrawPixel. It draws a pixel at a certain location with a certain color. I am using in 16bit mode, not Paletized. My problem is this:
   

DWORD color;

color = RGB(0,50,200); // I set the color. Is this the correct way?


DDBLTFX ddbltfx;
ddbltfx.dwSize = sizeof(ddbltfx);
ddbltfx.dwFillColor = color; // I set the color for DDBLTFX


lpSurface->Blt(&PixelRect,NULL,NULL,DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);

  
Now, I was trying to get some bluish color, but instead I always get pink. No matter what those values in the RGB thing are except when I set them all to 0s. Is there a different way to set the color? Thanks.
16 bit color is 1 word per pixel, not a double word. The Win32 RGB macro can only create dwords, so you''ll have to write your own macro to get 16 bit color in whatever format you happen to be using (565 probably).

Resist Windows XP''s Invasive Production Activation Technology!
http://druidgames.cjb.net/ (If my website isn''t down, it''s a miracle!)
Advertisement
There are a lot of articles on the 16-bit pixel plotting. Look in the DirectDraw reference in the Programming section, located in the Online-Developer Resources.

It''s a good start.

Thanks guys.

This topic is closed to new replies.

Advertisement