My camera still not moving

Started by
3 comments, last by arkansas 21 years, 6 months ago
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
Advertisement
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.

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
Hey

I use PeekMessage...
I heared of that problem before so I changed it.

This topic is closed to new replies.

Advertisement