PDA

View Full Version : sorry for disturbing u all , but i need ur help badli



alok47
07-30-2001, 04:39 AM
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.

Eric
07-30-2001, 04:49 AM
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).]

zed
07-30-2001, 03:29 PM
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

alok47
07-30-2001, 06:13 PM
thanx ERIC and ZED for solving my problem.