PDA

View Full Version : About light!



samson
10-11-2004, 11:08 PM
How many lights OpenGL can use? Only 8???

Relic
10-12-2004, 03:45 AM
It's implementation dependent. The minimum requirement in the OpenGL specs and what most implementations support is 8.
You can query it at runtime with glGetIntegerv(GL_MAX_LIGHTS, &maxLights);
Some implementations support 16 or 24 lights, but it's pretty useless.
If you need more than 8 lights, you can either take a virtual lights approach and only use the 8 lights nearest to the object you're going to render, or use a multipass approach with blending, or put the lighting environment in a cubemap and and use texturing to put as many "lights" onto your object as you want in one pass.

samson
10-12-2004, 03:59 PM
Thanks@_@ :p