Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Plain Text by hellyeah ( 16 years ago )
#include <GL/gl.h>
#include <GL/glut.h>
#include <stdio.h>
void parametrizedHouse(GLintPoint peak,GLint width,GLint height)
{
GLint ChWidth = width/50;
GLint DoorWidth = width/10;
GLint DoorHeight= height/10;
GLint WindowW= width/10;
GLint WindowH= height/10;
//Skeleton of the House
glBegin(GL_LINE_LOOP);
glVertex2i((GLint)peak.x,peak.y);
GLintPoint secondPoint((GLint)peak.x+width/2, (GLint)peak.y-3*height/8);
glVertex2i(secondPoint.x,secondPoint.y);
GLintPoint thirdPoint((GLint)peak.x+width/2, (GLint)peak.y-height);
glVertex2i(thirdPoint.x,thirdPoint.y);
GLintPoint fourthPoint((GLint)peak.x-width/2,(GLint)peak.y-height);
glVertex2i(fourthPoint.x,fourthPoint.y);
GLintPoint fifthPoint((GLint)peak.x-width/2,(GLint)peak.y-3*height/8);
glVertex2i(fifthPoint.x,fifthPoint.y);
glEnd();
//Chimeney of the house
glBegin(GL_LINE_STRIP);
glVertex2i(((peak.x+fifthPoint.x)/2)-ChWidth, ((peak.y+fifthPoint.y)/2)-ChWidth);
glVertex2i(((peak.x+fifthPoint.x)/2)-ChWidth,peak.y);
glVertex2i(((peak.x+fifthPoint.x)/2)+ChWidth,peak.y);
glVertex2i(((peak.x+fifthPoint.x)/2)+ChWidth,((peak.y+fifthPoint.y)/2)+ChWidth);
glEnd();
//Door of the House
glBegin(GL_LINE_STRIP);
glVertex2i(((thirdPoint.x+fourthPoint.x)/2)-DoorWidth,fourthPoint.y);
glVertex2i(((thirdPoint.x+fourthPoint.x)/2)-DoorWidth,fifthPoint.y-DoorHeight);
glVertex2i(((thirdPoint.x+fourthPoint.x)/2)+DoorWidth,fifthPoint.y-DoorHeight);
glVertex2i(((thirdPoint.x+fourthPoint.x)/2)+DoorWidth,fourthPoint.y);
glEnd();
//Window of the House
glBegin(GL_LINE_LOOP);
glVertex2i(((thirdPoint.x+((thirdPoint.x+fourthPoint.x)/2)+DoorWidth)/2)-WindowW,fifthPoint.y-DoorHeight);
glVertex2i(((thirdPoint.x+((thirdPoint.x+fourthPoint.x)/2)+DoorWidth)/2)-WindowW,fifthPoint.y-DoorHeight+WindowH);
glVertex2i(((thirdPoint.x+((thirdPoint.x+fourthPoint.x)/2)+DoorWidth)/2)+WindowW,fifthPoint.y-DoorHeight+WindowH);
glVertex2i(((thirdPoint.x+((thirdPoint.x+fourthPoint.x)/2)+DoorWidth)/2)+WindowW,fifthPoint.y-DoorHeight);
glEnd();
glFlush();
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
parametrizedHouse(50, 35, 25);
glFlush();
}
void myinit()
{
glClearColor(1.0, 1.0, 1.0, 1.0);
glColor3f(1.0, 0.0, 0.0);
glPointSize(1.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0.0, 499.0, 0.0, 499.0);
}
int main(int argc, char** argv)
{
/* standard GLUT initialization */
glutInit(&argc;,argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB); /* default, not needed */
glutInitWindowSize(500,500); /* 500x500 pixel window */
glutInitWindowPosition(0,0); /* place window top left on display */
glutCreateWindow("Bresenham's Algorithm"); /* window title */
glutDisplayFunc(display); /* display callback invoked when window opened */
myinit(); /* set attributes */
glutMainLoop(); /* enter event loop */
}
yz@xyz:~/comp304$ c++ -lGLU -lglut house.c
house.c:6: error: ‘GLintPoint’ was not declared in this scope
house.c:6: error: expected primary-expression before ‘width’
house.c:6: error: expected primary-expression before ‘height’
house.c:6: error: initializer expression list treated as compound expression
house.c:7: error: expected ‘,’ or ‘;’ before ‘{’ token
house.c: In function ‘void display()’:
house.c:55: error: ‘parametrizedHouse’ cannot be used as a function
Revise this Paste
Children: 18859