I am trying to create a Flight Simulator and I am currently using the glLookat function to move the plane when the user presses a button. But I need to move the plane without the user pressing a button. Is there some looping construct that will keep iterating the glLookat function? Have tried a for loop but as you can guess the program just freezed!!!
But it all depends on what you are using, it would be nice if you could give some info on what you are using for your application development, is it Win32, GLUT, SDL or something else, because they all do it in different ways.
control_loop() // this will be called repeatitly, with something like glutIdleFunc, or a timer event.
{
process_keyboard_input();
update_plane_position_data();
check_for_collision();
update_display();
}
Originally posted by TolTol:
[b]Hello,
I am trying to create a Flight Simulator and I am currently using the glLookat function to move the plane when the user presses a button. But I need to move the plane without the user pressing a button. Is there some looping construct that will keep iterating the glLookat function? Have tried a for loop but as you can guess the program just freezed!!!
Yeah, the func either needs to be in a class and static, or global. This is because the C++ compiler takes your TForm::myKeyboard() and changes it into myKeyboard(TForm&). Also, doesnt the GLUT callback function require some arguments? I am about sure that if you have the appropriate arguments in that function, it would work. I just dug em up for you… Your func should be of the form
myKeyboard(unsigned int key, int x, int y)
where x and y are the current cursor (mouse) position.