From 8830c99152df55e674be75600e0a3dca1ac99e3e Mon Sep 17 00:00:00 2001
From: Kyle K <kylek389@gmail.com>
Date: Mon, 18 Oct 2010 00:22:04 -0500
Subject: GL_todo.txt: some thoughts on the shadow mapping

---
 sdl/GL_notes.txt |  8 ++++++++
 sdl/pyramid.c    | 18 +++++++++---------
 2 files changed, 17 insertions(+), 9 deletions(-)

(limited to 'sdl')

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);
-- 
cgit v1.2.3