Stencil buffer shadows

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
siberianstar
Posts: 70
Joined: Thu Jun 22, 2006 9:24 pm

Stencil buffer shadows

Post by siberianstar »

Hello,

i'm trying to draw stencil shadows with PSPGL but i can't get it working,

here is the code:

Code: Select all

	glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT |
		GL_POLYGON_BIT   | GL_STENCIL_BUFFER_BIT   );

	glDisable(GL_LIGHTING);
	glDisable(GL_FOG);
	glDepthMask(GL_FALSE);
	glDepthFunc(GL_LEQUAL);
	glEnable(GL_STENCIL_TEST);
	glColorMask(GL_FALSE, GL_FALSE,   GL_FALSE, GL_FALSE ); // no color buffer drawing
	glStencilFunc(GL_ALWAYS, 1,   0xFFFFFFFFL   );
	glColorMask(0, 0, 0, 0);
	glEnable(GL_CULL_FACE);

		glStencilOp(GL_KEEP, GL_INCR, GL_KEEP);
		glCullFace(GL_FRONT);

		glBegin(GL_TRIANGLES);

		s32 i;
		for&#40;i=0; i<count; ++i&#41;
			glVertex3f&#40;triangles&#91;i&#93;.X, triangles&#91;i&#93;.Y, triangles&#91;i&#93;.Z&#41;;

		glEnd&#40;&#41;;

		glStencilOp&#40;GL_KEEP, GL_DECR, GL_KEEP&#41;;
		glCullFace&#40;GL_BACK&#41;;

		glBegin&#40;GL_TRIANGLES&#41;;

		for&#40;i=0; i<count; ++i&#41;
			glVertex3f&#40;triangles&#91;i&#93;.X, triangles&#91;i&#93;.Y, triangles&#91;i&#93;.Z&#41;;

		glEnd&#40;&#41;;


	glPopAttrib&#40;&#41;;
ant suggestion ?
Kojima
Posts: 275
Joined: Mon Jun 26, 2006 3:49 am

Post by Kojima »

Did you have any luck with them?
siberianstar
Posts: 70
Joined: Thu Jun 22, 2006 9:24 pm

Post by siberianstar »

for now i'm working on something else, i will see for them later.
Post Reply