CompuForm Assigment 1: landscape · posted by vaibhav bhawsar Sep 14, 06:31

void drawLand ( void )
{
	float c = .00392;
	//glPolygonMode(GL_BACK,GL_LINE);
	glBegin(GL_QUADS);
	glColor3f(c*164,c*164,c*164);
	glVertex2f(0,windowW);
	glColor3f(c*60,c*95,c*105);
	glVertex2f(0,windowH/2);
	glVertex2f(windowW,windowH/2);
	glColor3f(c*224,c*224,c*224);
	glVertex2f(windowW,windowH);
	glEnd();
	// //
	glBegin(GL_QUADS);
	glColor3f(c*0,c*60,c*60);
	glVertex2f(0,windowH/2);
	glColor3f(c*66,c*105,c*60);
	// //
	glVertex2f(0,0);
	glVertex2f(windowW,0);
	glColor3f(c*66,c*105,c*60);
	glVertex2f(windowW,windowH/2);
	glEnd();
	// //	
	float x = 40;	
	//hill1
	glBegin(GL_TRIANGLES);
	glColor3f(c*60,c*80,c*60);
	glVertex2f(x+60,windowH/2+(70)+(mouseY/3));
	glColor3f(c*16,c*105,c*60);
	glVertex2f(x+180,windowH/2);
	glColor3f(c*0,c*60,c*60);
	glVertex2f(x,windowH/2);
	glEnd();
	// //
	//hill3
	glBegin(GL_TRIANGLES);
	glColor3f(c*60,c*80,c*60);
	glVertex2f(x+490,windowH/2+(120)+(mouseY/6));
	glVertex2f(x+600,windowH/2);
	glColor3f(c*0,c*60,c*60);
	glVertex2f(x+190,windowH/2);
	glEnd();
	// //
	//hill2
	glBegin(GL_TRIANGLES);
	glColor3f(c*60,c*80,c*60);
	glVertex2f(x+190,windowH/2+(100)+(mouseY/6));
	glVertex2f(x+300,windowH/2);
	glColor3f(c*0,c*60,c*60);
	glVertex2f(x+100,windowH/2);
	glEnd();
	// //
	//hill4
	glBegin(GL_TRIANGLES);
	glColor3f(c*60,c*80,c*60);
	glVertex2f(x+590,windowH/2+(70)+(mouseY/3));
	glColor3f(c*16,c*105,c*60);
	glVertex2f(x+690,windowH/2);
	glColor3f(c*0,c*60,c*60);
	glVertex2f(x+490,windowH/2);
	glEnd();
	// //
	//cloud
	float f = mouseX*.318/(255);
	glBegin(GL_TRIANGLE_FAN);
	glColor4f(c*53,c*230,c*233,mouseX*.318/(255));
	glVertex2f(161,507);
	glVertex2f(161,523);
	glVertex2f(174,527);
	glVertex2f(187,523);
	glColor4f(c*10,c*150,c*233,mouseX*.318/(255));
	glVertex2f(195,515);
	glVertex2f(191,497);
	glVertex2f(179,487);					
	glVertex2f(174,487);	
	glVertex2f(161,495);
	glVertex2f(151,488);
	glVertex2f(144,487);
	glVertex2f(140,492);
	glVertex2f(135,492);
	glVertex2f(129,495);
	glVertex2f(128,501);
	glColor4f(c*53,c*230,c*233,mouseX*.318/(255));
	glVertex2f(133,508);
	glVertex2f(139,512);
	glVertex2f(151,519);
	glVertex2f(161,523);					
	glEnd();
	// //
	//river
	float xr = windowW/2+(mouseX);
	float yr = windowH/2;	
	glColor4f(c*53,c*230,c*233,.1);	
	glBegin(GL_TRIANGLE_STRIP);
	//left
	glVertex2f(windowW/2-(10),windowH/2);
	//right
	glVertex2f(windowW/2+40,windowH/2);
	glVertex2f(windowW/2-(xr/5),yr-20);
	glVertex2f(xr,yr-10);
	glVertex2f(windowW/2-(xr/4.5),yr-40);	
	glVertex2f(xr,yr-20);
	glVertex2f(windowW/2-(xr/4.3),yr-50);	
	glVertex2f(xr+20,yr-60);
	glVertex2f(windowW/2-(xr/4),yr-60);	
	glVertex2f(xr+40,yr-80);
	glVertex2f(windowW/2-(xr/3.5),yr-80);	
	glVertex2f(xr+60,yr-100);
	glVertex2f(windowW/2-(xr/3),yr-100);	
	glVertex2f(xr+80,yr-120);
	glVertex2f(windowW/2-(xr/2.5),yr-120);	
	glVertex2f(xr+100,yr-140);
	glVertex2f(windowW/2-(xr/2),yr-140);	
	glVertex2f(xr+120,yr-160);
	glVertex2f(windowW/2-(xr/1.5),yr-160);	
	glVertex2f(xr+140,yr-180);	
	glVertex2f(windowW/2-(xr),60);	
	glVertex2f(xr+180,0);
	glVertex2f(windowW/2-(xr),0);	
	glEnd();	
}

Commenting is closed for this article.