Hello,This is the first time for me to post in a forum and I hope that this will help me.
I need to ask how can I animate the light and make it rotate around a sphere…
I think it is easy but I can’t get it
Thank u in advance
There is a redbook sample for this here:
http://www.opengl.org/resources/code/samples/redbook/movelight.c
if you want to make the torus a sphere change the line that reads
glutSolidTorus (0.275, 0.85, 8, 15);
to something like this:
glutSolidSphere(1.0, 20, 20);
the part you are interested in is here:
glPushMatrix ();
glRotatef (spin, 1.0, 0.0, 0.0);
glLightfv (GL_LIGHT0, GL_POSITION, position);
glTranslated (0.0, 0.0, 1.5);
...
glPopMatrix ();
which rotates the light by spin degrees at a distance of 1.5 from the sphere.
Thank u James very much =)