Simple 2d shadows?
BlitzMax Forums/OpenGL Module/Simple 2d shadows?
| ||
How can I achieve this with opengl lighting? I have a simple lighting system which I played with from an example that was on the forums using:glEnable GL_LIGHTING glEnable GL_LIGHT0 Global l0_diffuse:Float[] =[0.0, 1.7, 0.0, 1.0] glLightf GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.0 glLightf GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.001 glLightf GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.0001 l1_position[0] = 100 l1_position[1] = 100 glLightfv GL_LIGHT1, GL_POSITION, l1_position With that I was able to create a quick lighting system, but how would I create a simple shadow using these lights (rather than fake shadows via polygons)? Not looking for texture/sprite shadows, but being able to create walls with a couple vectors to cast a nice shadow, based on the light source. Can someone provide a very small example of this, or a link to one? |
| ||
You won't That are vertex lights, they don't do anything else than make vertices getting colored with their own light basing on the distance and falloff method. If you want shadows in 2D then "fake shadows" (there is a module for that) are the only way to do it. True shadow needs 3D + Stencil / shader. |
| ||
Edit: Nevermind. Polygons work better than I thought. Thanks |