Results 1 to 3 of 3

Thread: wrong lighting with Vertex Arrays

  1. #1

    wrong lighting with Vertex Arrays

    Hi!

    I am now using vertex arrays for drawing terrain. The terrain is rendered with a LOD algorithm and uses GL_TRIANGLE_FAN. The triangles are drawn normally but the lighting is wrong. I noticed that the lighting is only below the terrain. So, when I move below the terrain, I see a correct lighting of the inverse terrain. The vertex calculation didn't change from earlier implementations where I used glBegin/End and explicitely used Normal3fv. The vertex array is as big as the normals array. Each vertex has a normal. I also tried to change glFrontFace, but with no effect. So, has anyone a hint what I've done wrong?

    thanks,
    Steve

  2. #2
    Guest

    Re: wrong lighting with Vertex Arrays

    I'm not exactly sure what ur saying and i'm not that great with lighting, but maybe you might have the light position on the wrong side of the terrain. That's all I can think of. Like I said i'm not that great.

  3. #3
    Senior Member Frequent Contributor
    Join Date
    Jan 2003
    Location
    Virginia
    Posts
    586

    Re: wrong lighting with Vertex Arrays

    Is your winding clockwise or counterclockwise or are your normals pointing below the surface? The default winding is counterclockwise (right-hand rule). You can change the winding using glFrontFace( GL_CW ) to reverse this or you can change your algorithm to travel counterclockwise. ANd, also verify your light position as the previous poster suggested.

Similar Threads

  1. arrays of arrays as vertex output/fragment input
    By tsojtsoj in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 05-17-2018, 08:02 PM
  2. Vertex Arrays, interleaved arrays, mouseMove func
    By Nibirue in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-13-2012, 11:17 AM
  3. Vertex Arrays and Lighting
    By bdxxxx in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 03-24-2010, 07:06 PM
  4. Vertex Arrays: Interleaved or seperated arrays?
    By Jan in forum OpenGL: Advanced Coding
    Replies: 16
    Last Post: 06-21-2005, 05:25 AM
  5. my vertex arrays code! what is wrong here?
    By worm in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 04-05-2001, 02:23 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