Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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
C++
#include <glut.h>
#include <conio.h>
//#include <iostream.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();
    //glflush();
}
void ifIDLE()
{
    a += .3;
    b = b + C;
    if (a >= 15.0)
    {
        C = -1.0 * C;
        a = 0.0;
    }
    //glTranslatef();
    //glutWireCube();
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);
    //glFrustum(-1.0, 1.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);
    //glutMainLoop();
    init();
    glutMainLoop();
    //cin>>C;
    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;-)
Posted
Updated 10-Mar-11 5:07am
v3
Comments
OriginalGriff 10-Mar-11 11:02am    
You forgot to ask a question.
What is it doing that it shouldn't, or not doing that it should?
Or are you just asking us how to do any of it?
Henry Minute 10-Mar-11 11:06am    
Help you on debugging what? Where is the bug? What is the bug?
fjdiewornncalwe 10-Mar-11 13:18pm    
Please ask something specific. What you have put up so far is more of a "can you finish this for me" question as opposed to a "help me" question.
Note.. We won't help on "can you finish this for me" questions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900