// 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

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?

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.


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.

how to convert to float?

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)

Hope that helps.

Edit: Stoopid typos

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