PDA

View Full Version : camera problem



zoodoo
01-23-2012, 11:34 PM
Hi
I am new to opengl and i am trying to draw a triangle on the ZY plane. I am using gluLookAt to view my model but i am seeing only part of it. Everytime i put a value greater than 1 in the eye coordinates i get a black screen. Please help!!!
Here are my codes:


# include <iostream>
# include <GL/glut.h>

using namespace std;



void draw()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();




gluLookAt(1.0,0.0,0.0,0.0,0.0,0.0,0.0,1.0,0.0);
glBegin(GL_TRIANGLES);


glVertex3f(0.0,0.0,0.0);
glVertex3f(0.0,2.0,2.0);
glVertex3f(0.0,0.0,4.0);


glEnd();

glutSwapBuffers();
}

int main(int argc, char **argv)
{
glutInit(&amp;argc, argv);
glutInitDisplayMode(GLUT_DOUBLE|GLUT_RGB|GLUT_DEPT H);
glutInitWindowSize(400,400);
glutCreateWindow("Theory");

glutDisplayFunc(draw);

glutMainLoop();
return 0;
}

Aleksandar
01-23-2012, 11:46 PM
Projection transformation is missing. Please, take a look at the third chapter of the Red book (or similar stuff about Viewing in 3D).

zoodoo
01-24-2012, 12:25 AM
thanks for the help!!
got it working!!

I just didn't know where to look for an answer