I wanna to make a camera which is moving in some ways such as Dolly, pan, Tilt, Track and orbit
I have a code example too
#include <glut.h>
#include <conio.h>
using namespace std;
GLfloat b=-0.5, a=0, C=0.04;
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
gluLookAt(.0, .0, .0, .0, .0, -1.0, .0, 1.0, .0);
glTranslatef(.0, .0, -3.0);
glutWireCube(1.0);
glutSwapBuffers();
}
void ifIDLE()
{
a += .3;
b = b + C;
if (a >= 15.0)
{
C = -1.0 * C;
a = 0.0;
}
glutPostRedisplay();
}
void init()
{
glClearColor(.0, .0, .0, .0);
glColor3f(1.0, .4, .2);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 10.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
int main(int argc,char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
glutInitWindowSize(500, 500);
glutInitWindowPosition(0, 0);
glutCreateWindow("perspective projection");
glutIdleFunc(ifIDLE);
init();
glutMainLoop();
return 0;
}
but I know it is not enough to have an app like the real one.
So any body has any idea about it:-?
Course I know I should make functions to have camera so help me on debugging;-)