Skip to main content
GameDev.net gamedev.net
🔒 Locked

Only EIGHT Lights ?!

Started by nitzan Nov 16, 2001 at 12:56 AM 6 replies 1.1k views
Original Post
nitzan
nitzan
I tried initializing a bunch of lights, but the compiler complains on: -> glLightfv(GL_LIGHT8, GL_AMBIENT, LightAmbientShell); scorch3d.cpp(943) : error C2065: ''GL_LIGHT8'' : undeclared identifier Any ideas ? Why is this happening ? Are there only 8 lights total (LIGHT0 to LIGHT7) in openGL ? How can I have more lights ? Nitzan ------------------------- www.geocities.com/nitzanw www.scorchedearth3d.net -------------------------
Floppy
Floppy
You can only have 8 lights in OpenGL. Essentially, that''s all you need, what most games do is clip the lights that aren''t being displayed.

You could write your own lighting procedures, but that would be time consuming; I have never had any real need for more than 8 lights.

Good luck!
Oniera
Oniera
Yup, only 8 lights. If I''m not mistaken don''t TnL 3D cards have this limit?


Demetrios Georgeadis
Director/Programmer
Oniera Software Artists

www.oniera.com


Demetrios GeorgeadisDirector/ProgrammerOniera Software Artistswww.oniera.com
Maximus
Maximus
8 is the minimum number of lights for an implementation, the GeForce3 has more iirc. Just add a number onto the end of GL_LIGHT0 to get to that light number, ie GL_LIGHT0+10 = light 10.

Also remember that the limit is number of lights per polygon. 8 lights per polygon is plenty.
-----------------------"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else's drivers, I assume it is their fault" - John Carmack
Ak37
Ak37
I''ve seen those PerPixel shader thingie for the GeForce 3. Using that will enable you to use unlimited number of lights. But that is with the cost of ::
It has to be run using GeForce3
You need to learn The Pixel Shader thingie (ASM)
It could get slow (well maybe 10 lights won''t slow up GF3 but you know the word infinity makes people tend to add more and more).

That''s all I know
Help me with my Isometric OpenGL engine.
wolfman8k
wolfman8k
As Maximus said it''s 8 lights per polygon, not per scene! (More precisely 8 lights ber glBegin()/End() block)

I think that''s plenty!
zedzeek
zedzeek
certain expensive cards are able to do 16 or even 24 lights per polygon, though as others have said this is pretty much overkill
HelplessFool
HelplessFool
you shouldn''t need more or use more than 8 lights since you can use lightmapping.
you should also consider the performance hits caused by using all 8. they can really lower the performance on anything lower than a geForce3 - Radeon 8500.
I''m not guaranteeing that you can''t get good performance with lower cards and 8 lights but you have to have much more optimized code and faster routines.
i go from 4.1 to 1.5 million triangles per second when i go from 1 light to 8 ( results tested with 3DMark 2001 )
of course i only have a PII 450 and Radeon SDR but you can see the performance goes down signifigantly. a faster processor would help but you get the idea right? after all, the lighting calculations are done in the v-Card not the processor.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.