summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle K <kylek389@gmail.com>2010-10-18 00:22:04 -0500
committerKamil Kaminski <kamilkss@gmail.com>2010-10-18 00:22:04 -0500
commit8830c99152df55e674be75600e0a3dca1ac99e3e (patch)
tree4b638824a62a0585481b0ee32049893aac7edeb8
parentcd22d3731e2eb0c6ab6ac91aa78c11fa98544389 (diff)
downloadGLPyramid-8830c99152df55e674be75600e0a3dca1ac99e3e.tar.gz
GLPyramid-8830c99152df55e674be75600e0a3dca1ac99e3e.tar.bz2
GLPyramid-8830c99152df55e674be75600e0a3dca1ac99e3e.zip
GL_todo.txt: some thoughts on the shadow mapping
-rw-r--r--sdl/GL_notes.txt8
-rw-r--r--sdl/pyramid.c18
2 files changed, 17 insertions, 9 deletions
diff --git a/sdl/GL_notes.txt b/sdl/GL_notes.txt
index 59267e0..f012068 100644
--- a/sdl/GL_notes.txt
+++ b/sdl/GL_notes.txt
@@ -56,3 +56,11 @@ Pipeline
glDrawArrays() || glDrawElements()
glDisableClientState()
+Shadowmap
+- getting the depth buffer from lights point of view of the scene, we don't swap
+ we only care about raw geometry
+ we regenerate the shadow map if the light or boject moves, or window size changes
+ first we draw the scene with dim lighting, then we double the the values of lighting
+ one depth buffer is written to the backbuffer, we retrieve that into a texture, then
+ lots of magic is done to project the texture/shadow map back into the final scene
+
diff --git a/sdl/pyramid.c b/sdl/pyramid.c
index 783b2de..91d03f1 100644
--- a/sdl/pyramid.c
+++ b/sdl/pyramid.c
@@ -157,13 +157,13 @@ static void setup_opengl(void)
ground_list = glGenLists(2);
triangle_list = ground_list + 1;
- glNewList(ground_list, GL_COMPILE);
- gltDrawGround();
- glEndList();
-
- glNewList(triangle_list, GL_COMPILE);
- gltDrawTriangle();
- glEndList();
+ glNewList(ground_list, GL_COMPILE);
+ gltDrawGround();
+ glEndList();
+
+ glNewList(triangle_list, GL_COMPILE);
+ gltDrawTriangle();
+ glEndList();
}
static void keys(SDL_keysym *keysym, unsigned int *keys_held, int flag)
@@ -180,7 +180,7 @@ static void keys(SDL_keysym *keysym, unsigned int *keys_held, int flag)
case SDLK_UP: glframe_move_forward(&camera, 0.5f); break;
case SDLK_DOWN: glframe_move_forward(&camera, -0.5f); break;
case SDLK_LEFT: glframe_rotate_local_y(&camera, 0.1f); break;
- case SDLK_RIGHT: glframe_rotate_local_y(&camera, -0.1f); break;
+ case SDLK_RIGHT: glframe_rotate_local_y(&camera, -0.1f); break;
default: break;
}
}
@@ -202,7 +202,7 @@ static void keys(SDL_keysym *keysym, unsigned int *keys_held, int flag)
if (keys_held[SDLK_LEFT])
glframe_rotate_local_y(&camera, 0.02f);
if (keys_held[SDLK_RIGHT])
- glframe_rotate_local_y(&camera, -0.02f);
+ glframe_rotate_local_y(&camera, -0.02f);
}
xRot = (GLfloat) ((const int) xRot % 360);