View Full Version : Please help!!!Next Monday exam on OpenGL

09-22-2005, 02:01 PM
Hy everybody (i'm italian, sorry in advance for my english!). I've got 2 problems:
1. the italian prime minister (but i don't think you can solve this problem).
2. something wrong in my OpenGL application that i have to give my teacher next monday.
Well: i start saying that i'm using double buffering. i've got a simple cube inside a scene and several cameras from wich i look at this cube from different positions. I've got 2 positional lights focused on the cube. Here's the question: when i change from one camera to another the position of lights changes without any order or reason. then i press again the button associated with this new camera and lights work well.
For example, let's assume i have the following:


light_position );
spot_direction );


other code....

if(key == 1)
update camera 1 position
if(key == 2)
update camera 2 position
if(key == n)
update camera n position

In this code by pressing button "2" i change to camera 2 sight, then i call Display to draw the cube from that new viewpoint and then lights are added according the their fixed direction.
Unfortunately it doesn't happen this way!
In fact when i press button "2" the cube is correctly redrawn with the new viewpoint but with wrong direction of the spotlight :mad: then i press again the same "2" button and everything is correct :confused:
Someone told me it could be a matter of refreshing of the image, someother a problem of double buffering.......I only know that this is a problem that surely will arise at the exam next monday, so if you can help me i would appreciate it very much. If you need more details ask to me.
Thanks in advance ,