Hi,
I’m having a bit of trouble visualizing the whole camera thing. I get confused between changing the “view” using translatef and gluLookAt…
Right now I’m just trying to draw a cube glWireCube(1.0);, and “zoom out” so that it looks farther away. From my textbook, I understood that if I used translatef(0.0,0.0,-0.5); the effect will be as though I move the cube 0.5 units (pixels?) down the negative z-axis.
I tried the following:
#include <gl/glut.h> // GLUT header file
#include <gl/gl.h> // OpenGL header file
void display() {
glColor3f(1.0,0.0,0.0);
glTranslatef(0.0,0.0,-0.5);
glRotatef(45.0,1.0,1.0,0.0);
glutWireCube(1.0);
glFlush();
}
void main(int argc, char **argv) {
glutInit(&argc, argv);
glutCreateWindow("Q1");
glutDisplayFunc(display);
glutMainLoop();
}
But it’s cutting out the back of the cube. I don’t understand why…
Sorry for this ultra-newbie question. Hopefully, I’ll get a feel for this soon enough.
- Canadian0469
Note: I know that I can just increase my viewing volume using
glMatrixMode(GL_PROJECTION);
glOrtho(-2, 2, -2, 2, -2, 2);
for example, but I want to know why what I tried above doesn’t work. Does it have to do with the initial viewing volume being too small?