Archived

This topic is now archived and is closed to further replies.

My camera still not moving

This topic is 5537 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites