[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] shadow demo



The algorithm is the same--shadow mapping. 

What have I changed?  Hard to say.  Here's what happened:
-Since beginning PyOpenGL programming nearly two years ago, I always wanted to make something using shadows.  When I first started, I was still unfamiliar with Python, though I had been doing stuff with PyGame for a while.  For a month or so, making shadows was way beyond me (I was struggling with gl windows and other random stuff)--which is not to say I didn't try.  Naturally, nothing really came of it. 
-Skipping ahead a year or so, but still about a year ago, I FINALLY got a PyOpenGL shadow demo, but it didn't work because it used PyOpenGL for the matrix multiplication, and that was broken for some reason. 
-After that was sorted out, I had a working demo, which I refined down to a module about 1/3 the size of the original which could be tacked onto anything.  It worked brilliantly--as long as you were using the objects which came with the demo (the purple triangular thing and the green landscape).  I tried my objects--a cube and a randomly generated terrain, but they didn't work. 
-I couldn't figure out why, and for a long time, the project sat, annoying me.  This must have been several months.  Throughout all this, I had been trying to make shadows in one way or another using various code--the final count is 26 attempts at shadowing!
-Yesterday, I tried fixing it again, and within five minutes had isolated the problem to the object texture code.  As my objects were being drawn, the texture was disabled via a misplaced glDisable() call.  Turns out GL_COLOR_MATERIAL works even if GL_TEXTURE_2D is enabled, so the call wasn't necessary and it was breaking shadows because shadows use a depth texture.  Stupid errors like that annoy me.  From there, I emailed everyone here and it was only a matter of a few hours to release 'OpenGL Library'. 

Ian