Pure White? I wanted a shade of Green...

Started by
5 comments, last by Estauns 20 years, 4 months ago
I''m using 2D Ortho view, and I''m trying to draw a quad. But it always turns out white. With the colours I''ve put in there, I was expecting a full green with a little shade of red and blue tossed in for some variety. But the quad comes up a perfect bright shade of white. Can anyone fill me in? glLoadIdentity(); glTranslatef((float)320, (float)240, 0.0f); glBegin(GL_QUADS); glColor3d(24, 255, 24); glVertex2d(-16, 16); glVertex2d( 16, 16); glVertex2d( 16,-16); glVertex2d(-16,-16); glEnd();
"Where genius ends, madness begins."Estauns
Advertisement
1 is the max number you have to have to get that full color and 0 for black. change it to something like glColor3d(0.2f, 1.0f, 0.2f);

---------------------------
The pipes clangor all the time.
---------------------------The pipes clangor all the time.
Or use:
glColor3ub(24, 255, 24);

LizardCPP
glColor3d -> d is for deouble not for decimal
read redbook for function post-fixes description

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
Thanks guys, all solved. I''ll go ahead and use glColor3ub =P
"Where genius ends, madness begins."Estauns
You can have
glColor 3/4 f/d/b/ub

(stands for float/double/byte/unsigned byte)

The 3 and 4 are the number of values entered in, being RGB or RGBA respectively.
Have I forgotten anything?

[edited by - strider44 on December 16, 2003 8:46:37 AM]
The Love Of Trees
I think the full set of color commands is:

void glColor3{b s i f d ub us ui} (TYPEr, TYPEg, TYPEb);
void glColor4{b s i f d ub us ui} (TYPEr, TYPEg, TYPEb, TYPEa);
void glColor3{b s i f d ub us ui}v (const TYPE*v);
void glColor4{b s i f d ub us ui}v (const TYPE*v);
void Color3hNV(half red, half green, half blue);
void Color3hvNV(const half *v);
void Color4hNV(half red, half green, half blue, half alpha);
void Color4hvNV(const half *v);

for more details see the redbook and the GL_NV_half_float extension specification.

Enigma

This topic is closed to new replies.

Advertisement