# Direct3D quick question.

This topic is 4884 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

In the D3DXCOLOR structure could somebody please tell me what are the minimum and maximum values of the data members. They are listed as floats, so is this the usual 0.0f to 1.0f range? There was no mention of the limits in the SDK upon a quick perusal. Thanks in advance. Kind regards. Mark Coleman [Edited by - mrmrcoleman on January 6, 2005 9:34:47 AM]

##### Share on other sites
That is correct. 0 to 1 represents 0 to 255.

Chris

##### Share on other sites
so basically u would put in the percentage over a hundred for colour.

like

0.33 would be 33% of possible RED/GREEN/BLUE

ace

Thanks guys.

Mark Coleman

##### Share on other sites
D3DCOLORVALUE lights can have r,g and b greater than 1 and less than 0. For lights, greater than 1 gives a very bright light, and negative lights are "Dark" lights. Given that D3DXCOLOR has a D3DCOLORVALUE conversion operator (converts D3DXCOLOR to D3DCOLORVALUE), I'd expect it to follow the same rules (i.e. allow values outside the 0...1 range)

##### Share on other sites
Ok, I will have to run some tests then, one other question though.

I have a struct which contains a D3DCOLOR memeber, it is initialised like this:

D3DCOLOR Color = D3DXCOLOR(r, g, b, a);// Whereby r, g, b, and a are floats between 0 and 1

However later in the code I need to adjust the alpha value, say subtract 0.1 from it.

How can I do this? I looked in the SDK and I can't find any information about the contents of the D3DCOLOR type, is there a function to extract the individual fields or similar?

Thanks again for any help.

Regards.

Mark Coleman

##### Share on other sites
If you take a look at d3d9types.h, you'll see this:

// D3DCOLOR is equivalent to D3DFMT_A8R8G8B8
#ifndef D3DCOLOR_DEFINED
typedef DWORD D3DCOLOR;
#define D3DCOLOR_DEFINED
#endif

So it's just a DWORD: 0xAARRGGBB

• 23
• 10
• 19
• 15
• 14