PDA

View Full Version : glLight*, glMaterial* and Hardware



06-20-2005, 04:09 AM
If I use the native OpenGL lighting routines and use the OpenGL material properties routines to color/shade my objects, will this fall back to software or will it be done in hardware on a decent (i.e. > original Geforce, lower if possible) system?

Additionally, if it does end up not being hardware accelerated, would it make the scene faster if I kept using the glLight*, glMaterial* functions anyway, or if I did the dot products, etc. by myself, so that the video card wouldn't necessarily stall while the calculations were being made?

(Basically I'm looking for an answer to whether or not the built in OpenGL functions for material and lighting will work for doing basic surface-light interaction calculations for those users that don't have vertex/fragment programs)

dorbie
06-20-2005, 03:11 PM
It depends on how many lights etc and which card.

Prior to GeForce most gamer class cards used the CPU for gl lighting, whether that's worth using depends on the efficiency of your code vs the software in the driver.

With GeForce and onward the hardware implements lighting and will be faster than your CPU, especially if you have other stuff you want to use the CPU for, but it can depend on factors like how many lights and other state you have.

With modern cards it will be MUCH faster to use the gl lighting and let the hardware do all the work reguardless of almost any other factors. Issues like max supported lights are an issue but there are examples that show how to deal with this, by using the most dominant lights for and illuminated object.