Beispiel #1
0
/*void drawrotatedhouse()
{
glColor3f(0.0, 0.0, 1.0);

glBegin(GL_LINE_LOOP);
  glVertex2f(result[0][0],result[1][0]);
  glVertex2f(result[0][1],result[1][1]);
  glVertex2f(result[0][3],result[1][3]);
  glVertex2f(result[0][4],result[1][4]);
  glEnd();
glColor3f(1.0,0.0,0.0);
  glBegin(GL_LINE_LOOP);
  glVertex2f(result[0][5],result[1][5]);
  glVertex2f(result[0][6],result[1][6]);
  glVertex2f(result[0][7],result[1][7]);
  glVertex2f(result[0][8],result[1][8]);
  glEnd();
glColor3f(0.0, 01.0, 0.0);
  glBegin(GL_LINE_LOOP);
  glVertex2f(result[0][1],result[1][1]);
  glVertex2f(result[0][2],result[1][2]);
  glVertex2f(result[0][3],result[1][3]);
  glEnd();

}
*/
void display()
{
	
glClear(GL_COLOR_BUFFER_BIT);	
theta=rad;
drawhouse(house);
rotate();
drawhouse(result);
glFlush();
}
int main()
{
	int gd=DETECT,gm,x=200,y=200;

	int x1w,y1w,x2w,y2w;
	int x1v,y1v,x2v,y2v;
	printf("Enter World Co-ordinates: ");
	scanf("%d%d%d%d",&x1w,&y1w,&x2w,&y2w);	//100,100,400,400

	printf("Enter Viewpoint Co-ordinates: ");
	scanf("%d%d%d%d",&x1v,&y1v,&x2v,&y2v);	//100,100,300,300

	initgraph(&gd, &gm, NULL);
	rectangle(x1w,y1w,x2w,y2w);
	drawhouse(x,y);

	delay(3000);
	cleardevice();

	// rectangle(x1w-x1w,y1w-y1w,x2w-x1w,y2w-y1w);
	// drawhouse(x-x1w,y-y1w);
	//
	// delay(3000);
	// cleardevice();

	rectangle(x1v,y1v,x2v,y2v);
	newdrawhouse(x-x1w,y-y1w,x1w,y1w,x2w,y2w,x1v,y1v,x2v,y2v);

	delay(3000);
	cleardevice();

	closegraph();
	return 0;
}