summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-08-01 15:44:43 -0700
committerEric Anholt <eric@anholt.net>2009-08-01 15:44:43 -0700
commitaa36ace5a0d14b6666886349a383ec93e770d8bb (patch)
tree493d34d6e74dd90df63ba4c92fce1c753b716c8f
parent10bdbdcc53ae67a1c88e3f81efa69dd8f3f52f24 (diff)
Increase texture size and replace cullface with PolygonOffset to reduce acne.
-rw-r--r--shadow_map.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/shadow_map.c b/shadow_map.c
index 8ec4d55..c02d71e 100644
--- a/shadow_map.c
+++ b/shadow_map.c
@@ -118,7 +118,7 @@ void
generate_rings_shadowmap(void)
{
int instance;
- int shadow_width = 256, shadow_height = 256;
+ int shadow_width = 1024, shadow_height = 1024;
GLboolean first_time = GL_FALSE;
if (shadow_prog == 0)
@@ -166,7 +166,11 @@ generate_rings_shadowmap(void)
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);
- glCullFace(GL_FRONT);
+ /* Move the faces away from the light, so that if they're compared
+ * for being lit, they'll tend to pass.
+ */
+ glPolygonOffset(2, 2);
+ glEnable(GL_POLYGON_OFFSET_FILL);
if (first_time) {
GLenum status;
@@ -194,7 +198,7 @@ generate_rings_shadowmap(void)
glDrawBuffer(GL_BACK);
glReadBuffer(GL_BACK);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glCullFace(GL_BACK);
+ glDisable(GL_POLYGON_OFFSET_FILL);
set_world_to_shadow_transform();
}