Results 1 to 4 of 4

Thread: How to control lighting effects on objects?

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2009
    Posts
    2

    How to control lighting effects on objects?

    This is my first time posting on this forums.
    I have a questions regarding lighting effects.
    I have placed a light source and have also drawn two objects. (i.e. a sphere and a cube).
    Let's say I want the sphere to be lit by the light source as per normal but the cube should be unaffected by the light source and be lit uniformly as when there is no light source.
    Any idea how I should go about doing it? Any help greatly appreciated.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,651

    Re: How to control lighting effects on objects?

    Quote Originally Posted by simProG
    This is my first time posting on this forums.
    I have a questions regarding lighting effects.
    I have placed a light source and have also drawn two objects. (i.e. a sphere and a cube).
    Let's say I want the sphere to be lit by the light source as per normal but the cube should be unaffected by the light source and be lit uniformly as when there is no light source.
    Any idea how I should go about doing it? Any help greatly appreciated.
    When you render the sphere, set the light's SPECULAR and/or DIFFUSE to something non-zero. When you render the CUBE, set both the light's SPECULAR and DIFFUSE to 0, and just set AMBIENT to non-0.

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2009
    Posts
    2

    Re: How to control lighting effects on objects?

    That worked! Thanks lots.

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    6

    Re: How to control lighting effects on objects?

    Why not just call glDisable and glEnable for lighting before and after drawing the cube?

Similar Threads

  1. Odd per pixel lighting effects
    By Grimfate202 in forum OpenGL: GLSL
    Replies: 0
    Last Post: 02-05-2011, 11:57 AM
  2. reverse effects of lighting?
    By illizit in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-08-2010, 06:24 AM
  3. Lighting Effects
    By dam123 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-05-2009, 10:38 AM
  4. Confused with lighting effects
    By lancea in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-19-2008, 06:23 PM
  5. Doom 3 lighting effects.
    By LostInTheWoods in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-13-2002, 04:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean