Equivalent to D3DRENDERSTATE_AMBIENT?

Hi,

I need to implement a function that produces the same effect as D3DRENDERSTATE_AMBIENT in Direct3D.

Do I need to use one of my lights? If so, am I supposed to use GL_LIGHT0 - I remember seeing something about it that seemed “special” - or is there another way?

Thanks,
Luke A. Guest.

Sounds like you want:

float color[4] = {r, g, b, a};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, color);

  • Matt

if u want global ambient light (applied to everything in the scene) use this
float amb[] = {0.5,0.5,0.5,1.0};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT,amb);

Yeah, thanks for that. I just found it in the red book :wink:

Thanks anyway,
Luke.