Something like this maybe?
vec3 cameraPosition = carPosition + vec3(20*cos(carAngle), 10,20*sin(carAngle)); vec3 cameraTarget = carPosition; vec3 cameraUp = vec3(0,1,0); glMatrixMode(GL_MODELVIEW); glLoadIdentity() gluLookAt(cameraPosition, cameraTarget, cameraUp); glTranslate(carPosition); drawCar();
You are not using the old and deprecated OpenGL API (glBegin and so on), you will need to do something like
mat4 ViewMatrix = LookAt(cameraPosition, cameraTarget, cameraUp);
source share