Pass 1: Drawing of the Depth Map
main.cpp
in the shader initialisation part of main(), create the depth shader
blinnShader = initShader( "shaders/blinn.vert", "shaders/blinn.frag");
...
texblinnShader = initShader("shaders/texblinn.vert", "shaders/texblinn.frag");
...
// LabA09 Shadow Map
depthShader = initShader("shaders/simpledepth.vert", "shaders/simpledepth.frag");
...Create the view and projection matrices from the light source
viewPos = ...
matView = ...
matProj = ...
// LabA09 Shadow Map
matLightView = glm::lookAt(lightPos, glm::vec3(0, 0, 0), glm::vec3(0, 1, 0));
matLightProj = glm::ortho(-3.0f, 3.0f,-3.0f, 3.0f, -5.0f, 15.0f);
...Before the event loop, add a call to initRenderToDepthTexture()
In the event loop, replace the drawings of your model/scene
Result

Last updated