04-25-2001, 05:34 AM
Dear Sirs
Im taking my first steps in using Opengl for various 3d visualizations,experimentally for the time. Problems often arise, so here i go with the questions.
1.Normals......
-Theory
You can specify a normal per vertex.
You can rotate,translate or scale a matrix.
-Conclusion
I CAN rotate a normal using this code:
glLoadIdentity();
glRotatef(RotAngle,0.0,1.0,0.0);
glNormal3f(0.0,0.0,1.0);
-In practice
The above code does not produce what i expect in a per vertex basis. If i use it once (not per vertex) it seems to be working with all the vertices.(Rendering is done in GL_POINTS)
-Question.
Assuming that everything else is correct (I can be sure for that, im not THAT begginer)
Will the above code rotate the normal around y axis?
Spotlights!!!!!
-Theory
You can setup a spotlight with all these opengl commands.
You can rotate it,make it point elsewhere and turn it on and off.
-Conclusion
I can setup the lights position to 5,5,5 and make it point to 0,0,0 by calling glLightfv with GL_POSITION and then specify a normal pointing to 0,0,0 (i apply it using glLightfv with GL_SPOT_DIRECTION).
To keep it steady i call glLoadIdentity everytime i set up my scene.
-In Practice
Everything works fine but when i use glLoadIdentity the position remains the same but the spotlights "character" changes.
If i dont use glLoadidentity the light is moving as the modelview matrix is rotated but the spotlights "character" is closer to what i have set (The cuttoff for example is sharper)
Can someone help me with all this?
Thanks in advance.
Im taking my first steps in using Opengl for various 3d visualizations,experimentally for the time. Problems often arise, so here i go with the questions.
1.Normals......
-Theory
You can specify a normal per vertex.
You can rotate,translate or scale a matrix.
-Conclusion
I CAN rotate a normal using this code:
glLoadIdentity();
glRotatef(RotAngle,0.0,1.0,0.0);
glNormal3f(0.0,0.0,1.0);
-In practice
The above code does not produce what i expect in a per vertex basis. If i use it once (not per vertex) it seems to be working with all the vertices.(Rendering is done in GL_POINTS)
-Question.
Assuming that everything else is correct (I can be sure for that, im not THAT begginer)
Will the above code rotate the normal around y axis?
Spotlights!!!!!
-Theory
You can setup a spotlight with all these opengl commands.
You can rotate it,make it point elsewhere and turn it on and off.
-Conclusion
I can setup the lights position to 5,5,5 and make it point to 0,0,0 by calling glLightfv with GL_POSITION and then specify a normal pointing to 0,0,0 (i apply it using glLightfv with GL_SPOT_DIRECTION).
To keep it steady i call glLoadIdentity everytime i set up my scene.
-In Practice
Everything works fine but when i use glLoadIdentity the position remains the same but the spotlights "character" changes.
If i dont use glLoadidentity the light is moving as the modelview matrix is rotated but the spotlights "character" is closer to what i have set (The cuttoff for example is sharper)
Can someone help me with all this?
Thanks in advance.