# The Industry's Foundation for High Performance Graphics

#### from games to virtual reality, mobile phones to supercomputers

Guyz I've a Quadric Object (Sphere) and I wanna set it's color 2 Yellow , or whatever , How Can I Set It's Color is there's any other way Insted of using Light or Texture?

do you tried to call glColor before drawing the object ???

Yea I did , but all I get is z a White Sphere ..

thats not normal, even if you have texturing enabled (and no texture bound) you should get the color defined in glColor ... maybe you call it the wrong way ???
glColor<3/4><f/d> accepts values from -1.0 to 1.0
and
glColor<3/4><u><i/s/b> accept values from 0 to 255

so you have too choose the correct function calling glColor3f(10,5,255) will produce white color, because the call is clamped to glColor3f(1.0f, 1.0f, 1.0f); !!! and in this case glColor3<i/s/b> would be correct ...

glColor<3/4><u><i/s/b> accept values from 0 to 255
Almost correct. The integer types maps the value 0 to the floatingpoint value 0.0. The largest possible value that can be represented by the integer type is mapped to the floatingpoint value 1.0.

That means, for an unsigned byte (glColor3ub), the range [0.0 1.0] is mapped to [0 255], since 255 is the largest value an unsigned byte can represent.

For signed byte (glColor3b), the range [0.0 1.0] is mapped to [0, 127], since 127 is the largest value a signed byte can represent.

For unsigned integers (glColor3ui), the range is [0, 4294967295], since that is the largest value a signed integer (32-bit) can represent (2^32 - 1).

An example. These six calls all have the same parameters, but they are all mapped to different floatingpoint values in the range [0.0 1.0], because their [0 MAX_VALUE] is different.
Code :
```glColor3b (127, 0, 0); // r = 1.0
glColor3ub(127, 0, 0); // r = 0.5
glColor3s (127, 0, 0); // r = 0.004
glColor3us(127, 0, 0); // r = 0.002
glColor3i (127, 0, 0); // r = 0.00000006
glColor3ui(127, 0, 0); // r = 0.00000003```
r is the floatingpoint value the red component is mapped to, rounded to one significant digit.

Of course, due to finite precision, the last four calls will probably end up in zero once in the frame buffer.

Originally posted by C17_H19_NO3_H2O:
Guyz I've a Quadric Object (Sphere) and I wanna set it's color 2 Yellow , or whatever , How Can I Set It's Color is there's any other way Insted of using Light or Texture?
If you have texturing enabled, you might want to try

glEnable(GL_COLOR_MATERIAL);

...Chambers

I tried z GlEnable(GL_COLOR_MATRIAL) n' It worked , Thnx alot Guyz , U were a great Help ...

I tried z GlEnable(GL_COLOR_MATRIAL) n' It worked , Thnx alot Guyz , U were a great Help ...