iris_raj
09-17-2003, 01:03 AM
#include <GL/glut.h>
Dear All,
I want to render to a 3d House(barn) . I wrote the following code.But its creating only front side with a triangle and a rectangle.It is not creating a thacthed house.What modifications should I make
void render(void)
{
GLfloat x,y,z,angle;
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glRotatef(xRot,1.0f,0.0f,0.0f);
glRotatef(yRot,0.0f,1.0f,0.0f);
glColor3f(0.0f,1.0f,1.0f);
glTranslatef(0.0,0.0,-5.0);
glBegin(GL_POLYGON);
glVertex3f(0.0,0.0,0.0);
glVertex3f(1.0,0.0,0.0);
glVertex3f(1.0,1.0,0.0);
glVertex3f(0.5,1.5,0.0);
glVertex3f(0.0,1.0,0.0);
glVertex3f(0.0,0.0,1.0);
glVertex3f(1.0,0.0,1.0);
glVertex3f(1.0,1.0,1.0);
glVertex3f(0.5,1.5,1.0);
glVertex3f(0.0,1.0,1.0);
glEnd();
glPopMatrix();
glutSwapBuffers();
/* glFlush(); */
}
Regards
Dear All,
I want to render to a 3d House(barn) . I wrote the following code.But its creating only front side with a triangle and a rectangle.It is not creating a thacthed house.What modifications should I make
void render(void)
{
GLfloat x,y,z,angle;
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glRotatef(xRot,1.0f,0.0f,0.0f);
glRotatef(yRot,0.0f,1.0f,0.0f);
glColor3f(0.0f,1.0f,1.0f);
glTranslatef(0.0,0.0,-5.0);
glBegin(GL_POLYGON);
glVertex3f(0.0,0.0,0.0);
glVertex3f(1.0,0.0,0.0);
glVertex3f(1.0,1.0,0.0);
glVertex3f(0.5,1.5,0.0);
glVertex3f(0.0,1.0,0.0);
glVertex3f(0.0,0.0,1.0);
glVertex3f(1.0,0.0,1.0);
glVertex3f(1.0,1.0,1.0);
glVertex3f(0.5,1.5,1.0);
glVertex3f(0.0,1.0,1.0);
glEnd();
glPopMatrix();
glutSwapBuffers();
/* glFlush(); */
}
Regards