0

I have this house centered in the origin at (0,0,0) with dimensions 10x10x20. I want to make an isometric projection but the house is not displayed.Here is the code for the house:

glBegin(GL_TRIANGLES);

//roof

glColor3f(1,1,0.35);
glVertex3f(-5, 5,  10);
glVertex3f( 5, 5,  10);
glVertex3f( 0,  11.160254,  10);

glColor3f(1,1,0.35);
glVertex3f(-5, 5,  -10);
glVertex3f( 5, 5,  -10);
glVertex3f( 0,  11.160254,  -10);

glEnd();

/* We tell we want to draw quads */
glBegin(GL_QUADS);

/* Every four calls to glVertex, a quad is drawn */


//roof
 glColor3f(1,1,0.5);
 glVertex3f(-5,  5,  10);
 glVertex3f( 0,  11.160254,  10);
 glVertex3f( 0,  11.160254,  -10);
 glVertex3f(-5,  5,  -10);

 glColor3f(1,1,0.5);
 glVertex3f(5,  5,  10);
 glVertex3f( 0,  11.160254,  10);
 glVertex3f( 0,  11.160254,  -10);
 glVertex3f(5,  5,  -10);


 //left face blue
 glColor3f(0, 0, 1); 
 glVertex3f(-5, -5, -10);
 glVertex3f(-5, -5,  10);
 glVertex3f(-5,  5,  10);
 glVertex3f(-5,  5, -10);


//right face cyan
glColor3f(0, 1, 1); 
glVertex3f( 5, -5, -10);
glVertex3f( 5, -5,  10);
glVertex3f( 5,  5,  10);
glVertex3f( 5,  5, -10);


//bottom face magenta
glColor3f(1, 0, 1); 
glVertex3f(-5, -5, -10);
glVertex3f(-5, -5,  10);
glVertex3f( 5, -5,  10);
glVertex3f( 5, -5, -10);


//top face yellow
glColor3f(1, 1, 0); 
glVertex3f(-5,  5, -10);
glVertex3f(-5,  5,  10);
glVertex3f( 5,  5,  10);
glVertex3f( 5,  5, -10);

//red back face
glColor3f(1, 0, 0); 
glVertex3f(-5, -5, -10);
glVertex3f(-5,  5, -10);
glVertex3f( 5,  5, -10);
glVertex3f( 5, -5, -10);


//front face green
glColor3f(0, 1, 0); 
glVertex3f(-5, -5,  10);
glVertex3f(-5,  5,  10);
glVertex3f( 5,  5,  10);
glVertex3f( 5, -5,  10);

glEnd();

Can someone help me with the parameters that I have to put in gluLookAt in order to get an isometric projection?

1 Answers1

1

Ok, you can try this:

gluLookAt(0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);

eye at (0.0, 0.0, 10.0), look at the center point (0.0, 0.0, 0.0), up is (0.0, 1.0, 0.0).

Below is very clear image to explain this function:

(from http://profs.sci.univr.it/~colombar/html_openGL_tutorial/en/08viewing_005.html)

Sorry I can't insert the image, because that need 10 reputation. :(

Alex Chi
  • 726
  • 6
  • 10
  • thanks. But now i can only see the green front face of the house. I mean the whole window is green. It is like the camera is zooming to the front face.Could you please explain what can I do ? –  Feb 04 '14 at 16:18
  • 1
    You can move the eye position, like (20.0, 20.0, 20.0). Why was my answer -2 score? Is it totally useless? Can you explain it? – Alex Chi Feb 04 '14 at 23:55