🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

DDraw7 colorfill problem

Started by
0 comments, last by fungame 24 years, 5 months ago
I am trying to colorfill a box on a 16 bit surface in fullscreen exclusive mode. However, when the actual blt is performed, it does not correspond with the RGB that was put in. I am using an ATI Rage IIc (Onboard) 4mb Here is what ive tryed (in pixel format DDPF_RGB(default format)): RGB(255,0,0) gives blue RGB(0,255,0) gives yellow RGB(0,0,255) gives black RGB(0,255,255) gives yellow RGB(255,255,255) gives white. RGB(255, 255,0) gives yellow RGB(0,100,0) gives red And it continues to bounce around like that. The color intensities do not change, but instead, after about 30 numbers, the color changes to another unrelated one, as shown in my last example. I have taken all these values and used them in DDraw Test, and it gives me the same weird colors. Has anyone had this problem? Any help would be appreciated.
Advertisement
I think your problem may be the fact that you are using a 16 bit color mode but trying to use 24 bit color values. The RGB() macro will produce a 32 bit that contains 8 bits of red, 8 bits of blue, and 8 bits of green information. When you try to use this in a 16 color mode, some of the color information is going to overflow and some of it is going to be lost altogether. (16 bit color modes typicaly use 5 bits of red, 6 bits of green, and 5 bits of blue information).

You will need to get the pixel format of the primary surface to find out exactly what format the color information needs to be in.

For now you could try substituting the values

0xf800 for RGB(255,0,0) red
0x07e0 for RGB(0,255,0) green
0x001f for RGB(0,0,255) blue

if you get get blue when you are expecting red try swaping the values for blue and red.

if you get colors that are close but not pure red or pure blue etc. try these values.

0x7c00 for RGB(255,0,0) red
0x03e0 for RGB(0,255,0) green
0x001f for RGB(0,0,255) blue

I hope this helps you out.

This topic is closed to new replies.

Advertisement