Results 1 to 5 of 5

Thread: glScale and normals

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2000
    Location
    Munich, Germany
    Posts
    3

    glScale and normals

    Hi all,

    I have a question concerning the normals of an object.

    In a modeller app, I generate the wireframe of an object, including normals at creation time of an object.
    I then allow the user to manipulate the transformations of the object. When a non-uniform scaling is used the normals are incorrect. Since I have stored the normals in a data structure when the object was created, I'd prefer not to have to regenerate them. Can I do a transformation on the calculated normals before passing them to OpenGL to correct for this?

    - Lutz

  2. #2
    Junior Member Newbie
    Join Date
    Feb 2000
    Location
    Reading,England
    Posts
    17

    Re: glScale and normals

    whenever you do non-uniform scaling just enable GL_NORMALIZE - this sorts it all out for you.
    kev.

  3. #3
    Junior Member Newbie
    Join Date
    Jun 2000
    Location
    Munich, Germany
    Posts
    3

    Re: glScale and normals

    Ahhh, thanks. At first I thought this is a global flag, but I see that I can enable it on a per-object basis, so I can check for scaling and then enable it if present.

    Thanks for the hint.

    - Lutz

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: glScale and normals

    When you do non-uniform scaling, your normals will be incorrect (point in the wrong direction) even if you normalize them. This will mess up lightning. There is no function to make the normals correct, other than to recalculate them.

    Just a note.

  5. #5
    Junior Member Newbie
    Join Date
    Jun 2000
    Location
    Munich, Germany
    Posts
    3

    Re: glScale and normals

    Hmmm. It looked pretty good

    I was wondering whether I could maybe use an inverse scale transformations for the pre-calculated normals before sending them to glNormal3(). Then OpenGL will transform them to the correct orientation when it uses them.

    While the lighting is not crucial (it's a preview only), I would like to get it right.
    But recalculating the pre-calculated normals is not something I want to do at this point.

    - Lutz

Similar Threads

  1. Where to put glScale?
    By Aliii in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-28-2012, 04:31 PM
  2. glScale
    By mr_coolio in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 03-27-2003, 08:30 AM
  3. glScale and Normals
    By mr_coolio in forum OpenGL: Basic Coding
    Replies: 10
    Last Post: 02-27-2003, 02:22 AM
  4. about glscale() -_-!
    By iux in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 02-05-2003, 04:22 AM
  5. glscale problem
    By amhigh in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 06-13-2002, 01:57 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