Advertisement Jump to content


This topic is now archived and is closed to further replies.


OpenGL D3D style Ambient in OpenGL

This topic is 6393 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, In D3D you can set pd3dDevice->SetRenderState(D3DRS_AMBIENT,(DWORD)D3DXCOLOR(0.5,0.5,0.5,1.0)). What is corresponding in OpenGL? I know I can set glLightfv(GL_LIGHT0,GL_AMBIENT,LightAmbient); but I think that corresponds to the Ambient in D3DLIGHT8 (pd3dDevice->SetLight(0,&light)). I need to know it for my D3D/OGL wrapper.

Share this post

Link to post
Share on other sites
Well, I don''t know what this does pd3dDevice->SetRenderState(D3DRS_AMBIENT,(DWORD)D3DXCOLOR(0.5,0.5,0.5,1.0));

maybe its the same as this

GLfloat ambient_light[] = {1.0f, 0.5f, 1.0f, 1.0f};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient_light);

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!