PDA

View Full Version : normals for sphere



Cerv36
04-28-2003, 10:36 PM
Hi,

I am making a solar system scene. I am using glutSolidSphere() to make the sun and the planets. I currently have ambient light for the scene and some sun emissive light.

I would like for the side of each planet that is facing the sun to be lighted. I assume this is done using diffuse light. I think I have the initial setup right (except normals-declaration), but am not seeing the light effects.

I did the following:
-positioned a light (GL_LIGHT0) at the location of the sun
-enabled LIGHT0
-and I enabled the diffuse property of the planet material (GL_AMBIENT_AND_DIFFUSE)

I know that I need normals for the surface so the diffuse intensity can be derived. So my question is this: does OpenGL 'know' the normals when using glutSolidSphere()? If not, is there an easy way to make some for a sphere?

Any help is much appreciated!
Thanks,
Bob

raverbach
04-29-2003, 03:24 AM
create an sphere made of lots of triagles
youŽll have total control over the vertex normals

or you can simply define a normal for your glut sphere using glNormalXX

bleifrei
04-29-2003, 12:51 PM
Hello,

as I know(maybe from redbook) You don't have to deal with normal if You use glutSolidSphere() for sphere drawing, because glut*() functions make the polygon mesh and normals too.

Brown

Cerv36
04-30-2003, 02:09 AM
Thanks . . . I think I've got it, now.