Results 1 to 3 of 3

Thread: scaling destroys lighting of glutSolidSphere

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2000
    Posts
    7

    scaling destroys lighting of glutSolidSphere

    if you scale a sphere created with glutSolidSphere using glScale, the lighting gets ruined. But if you scale your glutSolidSphere via parameter (radius) then everything is fine and lighting is perfect.

    Unfortunately, scaling with the radius won't make your sphere stretch along a specific axis (to form something like an ellipsoid).

    so I would assume that glScale is the only answer? if so, then how do you use glScale without ruining the normals defined inside the glutSolidSphere function?

    if this approach is not possible, then how would you rewrite glutSolidSphere to be more flexible such that you can scale along a specific axis via paramters:

    glutSolidEllipsoid(x_axis, y_axis, z_axis);

    Shogo2040

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2000
    Location
    Augsburg, Germany
    Posts
    334

    Re: scaling destroys lighting of glutSolidSphere

    Using glScale is always a problem with lighting, because the normal vectors get also scaled. And those are used to calculate the lighting. You can activate normalization with glEnable(GL_NORMALIZE), but that will slow down your app dramatically. The best thing is not to use glScale, but do the scale in geometry (like adjusting the radius of your sphere).

    Kilam.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Apr 2000
    Location
    Redlands, CA, USA
    Posts
    233

    Re: scaling destroys lighting of glutSolidSphere

    You can use GL_EXT_rescale_normal (if available).

Similar Threads

  1. Model with Cubemap destroys everything
    By Rockinredross867 in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 01-02-2016, 01:28 PM
  2. scaling affect the lighting on object??
    By somnath in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 05-14-2011, 11:52 PM
  3. Lighting and scaling
    By mhemsath in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-28-2004, 08:21 AM
  4. Strange lighting problem with negative scaling
    By zoldar256 in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 03-26-2003, 12:55 AM
  5. Scissor destroys z-buffer?
    By Pentagram in forum OpenGL: Advanced Coding
    Replies: 15
    Last Post: 07-03-2002, 08:20 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