Thread: opengl: maintaining colour when using lighting

  1. #1
    Registered User gazsux's Avatar
    Join Date
    Mar 2002
    Posts
    72

    opengl: maintaining colour when using lighting

    Hey, I just wondered how I can maintain the colours of the objects in my scene, as when i add lighting, everything just goes like greyscale. I have things like brown boxes and green grass etc. and it all ends up grey/blue/black kind of colours.

    I know theres the thing about the colour of lights in opengl, only returning that colour or something, but ive played about and cant seem to figure it. Any ideas? Cheers

  2. #2
    Banned
    Join Date
    Jan 2003
    Posts
    1,708
    Look into glMaterial and glColorMaterial on MSDN. Its been a while since I've used them but how they basically work is you can call glMaterial right before you draw your object and that sets what colors your object should reflect. glColorMaterial allows color tracking, which basically just means OpenGL sets the material properties (what colors of the light the object reflects) whenever you set your color. I would suggest using glColorMaterial because it is easier, and when you get drawing a lot of stuff its faster.

    go to msdn to read up on how to use it (it explians it better than I can )

  3. #3
    Registered User gazsux's Avatar
    Join Date
    Mar 2002
    Posts
    72
    ahh, cheers mate, i appreciate your help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. OpenGL lighting
    By Zishaan in forum Game Programming
    Replies: 6
    Last Post: 04-21-2007, 03:24 PM
  2. OpenGL lighting
    By BabyG in forum Game Programming
    Replies: 3
    Last Post: 08-29-2004, 09:58 AM
  3. Lighting in OpenGL
    By MathFan in forum Game Programming
    Replies: 5
    Last Post: 06-28-2004, 12:56 PM
  4. OpenGL lighting problems
    By sirSolarius in forum Game Programming
    Replies: 0
    Last Post: 12-01-2003, 09:11 PM
  5. need help with opengl lighting!!
    By genghis37 in forum Game Programming
    Replies: 1
    Last Post: 06-22-2002, 12:28 AM