Results 1 to 2 of 2

Thread: normals and lighting problems

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2003
    Location
    Moscow, ID, USA
    Posts
    5

    normals and lighting problems

    So I'm rendering an object using vertex arrays: position, normals, texcoords, ya know, the basics. I'm also rendering a light (and have used both directional and positional). The object renders fine.

    So I move and rotate the object and render again (in the same frame), but it looks exactly the same, as if the light moved with it. If a light shines on the front of an object, and I rotate the object 180 degrees, the light should then shine on the back of it, right?

    A possible cause could be that the normals don't rotate... but wouldn't this be bad behavior? My guess is I'm forgetting something simple. Any ideas?

    -boog

  2. #2
    Senior Member Regular Contributor
    Join Date
    Apr 2002
    Location
    St. Louis, MO USA
    Posts
    177

    Re: normals and lighting problems

    Sounds like you are calling glLightfv with the position parameters after you've done the modelview transform for your object. You should do glLightfv immediately after your camera transform.

    Here is some pseudocode for how to order your transforms with lighting and objects:

    main loop
    {

    DoCameraTransform
    Lights

    for each object
    {
    PushMatrix
    DoObjectTranform
    DrawObject
    PopMatrix
    }

    }

    [This message has been edited by ioquan (edited 10-27-2003).]

Similar Threads

  1. Lighting without Normals
    By Salbris in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 01-28-2010, 11:17 AM
  2. Normals and lighting
    By iris_raj in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 12-17-2003, 10:28 PM
  3. Lighting/Normals help
    By chennes in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-24-2003, 08:07 AM
  4. lighting and normals
    By Warrior in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 03-27-2001, 10:05 AM
  5. lighting and normals
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-26-2000, 03:19 PM

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