can someone please explain me why is the camera in my code moving on every onIdle callback? I am not changing any parameters so it seems to me that it should display the same all the time. Still cannot figure it out by myself, thanks for help
#include <iostream>
#include <math.h>
#include "gl/glut.h"
#include <windows.h>
using namespace std;
void Display(void){
glMatrixMode(GL_PROJECTION);
glFrustum(-0.5, 0.5, -0.5, 0.5, 0.8, 2);
gluLookAt (0,0,1, 0,0,0, 0,1,1);
glMatrixMode(GL_MODELVIEW);
glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
glutWireCube(0.2);
glFlush();
}
void onIdle(void){
Sleep(1000);
glutPostRedisplay();
}
int main(void){
glutInitDisplayMode(GLUT_DEPTH | GLUT_RGBA);
glEnable(GL_DEPTH_TEST);
glutCreateWindow("camera");
glutDisplayFunc(Display);
glutIdleFunc(onIdle);
glutMainLoop();
return 0;
}