# Thread: Having some problem with negative scale values and normals

1. ## Having some problem with negative scale values and normals

For example. I have an object that is scaled {-1,0,0}. Mirrored on the x axis, basically.

The gl code would kinda look like:

glScale(-1,0,0)
glNormal3fv(x,y,z)
draw_face()
glNormal3fv(x,y,z)
draw_face()
...

(x,y,z) is the computed normal of the untranslated face.

Of course, this doesn't work because all the normals are still reversed. Does the gl system not apply the current matrix to the glNormal call? Or maybe I just don't know what I'm doing (more likely).

I'm going to need to handle gluTessNormal stuff too, I'm wondering if it does or does not translate the normals by the current matrix.

I guess my question boils down to: Should I be calculating the normal based on the translated or untranslated version of the face?

Thanks for any info!

2. ## Re: Having some problem with negative scale values and normals

If I reverse the order in which I draw each face. It almost works. I can see the faces normally, but the lighting is reversed. It's dark on the side I'm looking at (which is normally light) and light on the backside.

Ohwell, off to pound my head some more...

3. ## Re: Having some problem with negative scale values and normals

Originally posted by Super-K:

glScale(-1,0,0)
This should be glScale (-1, 1, 1) !!!!

HTH

Jean-Marc

4. ## Re: Having some problem with negative scale values and normals

"Any modelview scaling that occurs is likely to mess up OpenGL's lighting equations. Remember, the lighting equations assume that normals have a length of 1.0. The symptom of incorrectly scaled normals is that the lit surfaces appear too dim or too bright depending on whether the normals enlarged or shrunk.

The simplest way to avoid this pitfall is by calling:

glEnable(GL_NORMALIZE);"

I took that from http://www.opengl.org/developers/cod...glpitfall.html

Hope it helps.
-lost hope

5. ## Re: Having some problem with negative scale values and normals

Thanks! That helped.

I had to go through everything by hand and make sure it was 100% correct. I was reversing the draw order (to invert the normals) but when I was calculating the draw normal I was inverting it again. It would then get inverted by the model matrix (negative scale) before being drawn. Ugh, or something like that, the lighting calculations had backwards normals.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•