My camera still not moving
Hi
this is how I did it...
float posY;
float VlookX = -30.0f, VlookZ = 20.0f;
float cameraX, cameraY, cameraZ;
float lookX, lookY, lookZ;
float angle = 0.0f;
float radians = 0.0f;
void InitCamera()
{
angle=25.0f;
posY=1.0f;
radians = float(PI*(angle-90.0f)/180.0f);
lookX = VlookX;
lookY = 5.0f;
lookZ = VlookZ;
cameraX = lookX + (float)sin(radians)*posY;
cameraZ = lookZ + (float)cos(radians)*posY;
cameraY = lookY + posY/2.0f;
gluLookA(cameraX,cameraY,cameraZ,lookX,lookY,lookZ,0.0,1.0,0.0);
VlookX +=0.2f;
VlookZ -=0.2f;
}
int RenderScene()
{
Init();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(0.0,-30.0,-10.0);
InitCamera();
InitFields();
return 0;
}
The camera is supposed to move as soon as I start the program.
But it only moves when I hot a key or move the mouse.
What is the matter???
arkansas
There is probably something wrong with yor main loop. Probably the camera functions are not called from it?
The InitCamera is called in the RenderScene() and the RenderSceen is called in the main loop. So everytime its calling the RenderScene its calling the InitCamera too.
October 16, 2002 11:44 AM
It could be because you use GetMessage instead of PeekMessage so that the mainloop is halted until your app gets a message from windows. I do not know if this is it, because I haven''t seen your main loop.
/ Jolle
/ Jolle
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement