hi..I am creating a 3d world with a building , ground and a sun.I recently put shadows using the stencill buffer.
The shadows works correctly but i have a problem.
This is the code of the building.

Code :
void LIBRARY()
{
	glPushMatrix();
 
	 LiblaryPavement();
	 LiblaryBase();
	 Liblary1stFloorSideDoorWalls();
 	 Liblary1stFloor();
	 Liblary2ndFloor();
	 LiblaryFront();
	 LiblaryCeiling();
	 LiblaryStairs();
 	LiblaryPilars();
	LiblaryStairFence();
	LiblaryFence();
	LiblaryBalcony();
	LiblaryRoof();
	LiblaryUpperPillars();
	LiblaryMainDoor();
	LiblaryDoors();
 
	glPopMatrix();
}
As you see i created parts of the building separately and when i put the stencill buffer to do his work and create the shadows of the building
it projects the shadows of the above code ( LiblaryMainDoor(); , LiblaryDoors(); ....) separately.
This is a photo of the problem.
Click image for larger version. 

Name:	20140906_190759.jpg 
Views:	131 
Size:	86.0 KB 
ID:	1425

You see? The shadows are the one above the other , having different dark values each.
I want all the shadows have the same dark values.

One solution is alpha blending but i cant figure out how......PlZ help



This is the code of creating the shadows....
Code :
	glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); 
	glDepthMask(GL_FALSE);
	glEnable(GL_STENCIL_TEST);
	glStencilFunc(GL_ALWAYS, 1, 0xFFFFFFFF);
	glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
 
 
	DrawWorld();
 
	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
	glDepthMask(GL_TRUE);
	glStencilFunc(GL_EQUAL, 1, 0xFFFFFFFF); 
	glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
 
 
	DrawWorld();
 
 
 
	glPushMatrix();
	glColor4f(0.0, 0.0, 0.0, 0.2);
	glDisable(GL_TEXTURE_2D);
	glDisable(GL_LIGHTING);
	glDisable(GL_DEPTH_TEST);
	glEnable(GL_BLEND);
	glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);
	shadowmatrix(floorShadow, groundplane, lightPosition);
	glMultMatrixf((float *)floorShadow);
 
 
			 glPushMatrix();  LIBRARY();	  glPopMatrix();
 
 
	glEnable(GL_TEXTURE_2D);
	glEnable(GL_DEPTH_TEST);
	glDisable(GL_BLEND);
	glEnable(GL_LIGHTING);
	glDisable(GL_STENCIL_TEST);
	glPopMatrix();
 
 
	glEnable(GL_BLEND);
 
 
	float illumination[4] = {1.0, 1.0, 0.82, 1.0};
	float illumination1[4] = {0.2, 0.2, 0.2, 1.0};
 
	glLightfv(GL_LIGHT0, GL_DIFFUSE, illumination);
	glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, illumination);
 
	glLightfv(GL_LIGHT0, GL_AMBIENT, illumination1);
	glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, illumination1);
 
			 glPushMatrix();  LIBRARY();	  glPopMatrix();