1. ## color

// set to GOLD color....

float mamb[]={0.24725f,0.1995f,0.0745f,1.0f}; //Ambient Reflection
float mdif[]={0.75164f,0.60648f,0.22648f,1.0f}; //Diffuse Reflection
float mspe[]={0.628281f,0.555802f,0.366065f,1.0f}; //Specular Reflection

glMaterialfv(GL_FRONT,GL_AMBIENT,mamb); //Set material properties
glMaterialfv(GL_FRONT,GL_DIFFUSE,mdif);
glMaterialfv(GL_FRONT,GL_SPECULAR,mspe);

how can i obtain the correct floating points as above in order to get my desired color?

how can i know that they stands for gold?

2. ## Re: color

the best way is to use a paint program that lets you specify colors using rgb values (ie photoshop, psp, mspaint?) the usual metric for rgb in these programs are unsigned bytes (either decimal or hex) you just have to convert it to a float.

jebus

3. ## Re: color

Gold isn't a color you can mix by RGB values. The best way should be to create a reflective or even mirroring texture and give it a dark yellow color.

4. ## Re: color

how to convert to float?

5. ## Re: color

RGB colors in paint programs are commonly calculated in unsigned bytes, with a range of 0-255. Therefore, you would simply divide the color value by 255 to get a float value for the color.

For example, suppose your RGB color in Photoshop is R=127 G=255 B=53
the float values would be:
R=127/255=0.498 (approx 0.5)
G=255/255=1.0
B=53/255=0.208

Hope that helps.

Edit: Stoopid typos

[This message has been edited by yakuza (edited 11-08-2002).]

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•