Skip to main content
gamedev.net
🔒 Locked

Lighting/color problem - beginner

Started by cherry 1 reply 250+ views
Original Post
cherry
cherry
Hi all, I have a gold colored object in the center but when I add a floor below it and a wall behind it, the object also takes on the colors of the floor/wall and becomes darker, no longer gold. The floor also changes to blue if I insert a blue object. I''ve tried tweeking several things in the lighting and coloring but with no success. my steps: 1. enable lighting 2. set material of floor, texture map the floor 3. set material/color of gold object -lighting and colormaterial is enabled throughout. what could I be doing wrong? Should i be enabling/disabling something I''m not? Thanks ahead of time for any help.
jamessharpe
jamessharpe
What you need to do is to set the color to white before you render the floor. What is happening is the floor is taking the color of the last object you drew. OpenGL is a state machine and so the parameters don''t reset each time you draw a new frame. So you don''t need to enable lighting every frame if you don''t disable it, however you do need to set the position of the light if you allow movement of the viewpoint.

James
cherry
cherry
thanks for the help! setting the color was exactly the problem I was having with the floor changing colors.

But I''m still stuck with why my gold object is changing colors by the color of the floor. For example, if i add a green floor below the object, the object becomes darker and is a greenish gold. I do set the color and material for each object now.

thanks ahead of time.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.