I want to basically create 开发者_如何学Pythona light that will make it so that its very bright around the player then gets progressively darker. Sort of like a fire torch. How can I get this effect? I can only seem to get an ambient light? How can it follow the camera?
Thanks
It sounds like what you are looking for is known as a point light.
If you are using fixed function, the following tutorial may be use to you: http://jerome.jouvie.free.fr/OpenGl/Tutorials/Tutorial13.php
Just note that this tutorial appears to use jogl with Java, but the conversion to C++ should be relatively straightforward.
For a glsl implementation, Lighthouse3d has a tutorial for GLSL 1.2 implementation of point lights.
精彩评论