Results 1 to 4 of 4

Thread: sorry for disturbing u all , but i need ur help badli

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2001
    Location
    india
    Posts
    12

    sorry for disturbing u all , but i need ur help badli

    I was trying to verify the effect of scaling the surface normals, but instead of some change in the lighting effect, the object ( which is a cube ) shape is getting distorted.
    My code is like this-

    1. setting unit normals for the object using
    glNormalPointer.
    2. calling glScale with some value to scale the normals
    3. and then drawing the object.
    As a result of this the object is getting scaled. Why its happenin

    I have rendered another object like this
    1. calling the first two steps above
    then calling glEnable ( GL_RESCALE_NORMAL ) And then drawing the object.
    the result is same , the object getting distorted.

  2. #2
    Senior Member Frequent Contributor
    Join Date
    Feb 2000
    Location
    France
    Posts
    880

    Re: sorry for disturbing u all , but i need ur help badli

    Using the glScale commands multiplies the current matrix (ModelView most of the time) with a scaling matrix.

    That means that both the normals AND the vertices will be scaled: it is perfectly normal for the object to be scaled as well. However, if the scaling is uniform, you shouldn't have any distortion....

    I don't know how to scale only the normals...

    Regards.

    Eric


    [This message has been edited by Eric (edited 07-30-2001).]

  3. #3
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: sorry for disturbing u all , but i need ur help badli

    as eric saiz using the same number in each place of glscale eg glScale(3,3,3) will result in uniform scaling but something like glScale(3,1,3) will result i distortion.

    the only way to scale normals would be to go glNormal3f(n.x*3,n.y*3,n.z*3) though why u would want to do this is a mystery

  4. #4
    Junior Member Newbie
    Join Date
    Jul 2001
    Location
    india
    Posts
    12

    Re: sorry for disturbing u all , but i need ur help badli

    thanx ERIC and ZED for solving my problem.

Similar Threads

  1. Redrawing an object without disturbing the remaining scene
    By Bhoot123 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-17-2018, 08:52 AM
  2. How to rotate a method without disturbing another mathod
    By waqar ahmad in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 06-16-2013, 08:04 AM
  3. Disturbing an Environment Map
    By JWeaver in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 06-13-2002, 11:08 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