zen
07-18-2004, 04:08 PM
This is not exactly a suggestion for a future version, rather a question wich has been bugging me for a few days and I suppose this is the place to ask it.
Is there a technical reason why although OpenGL used the object approach to handle multiple textures (introduced into the core in version 1.1 I believe?) it stayed with the fixed state approach for lights? I mean with textures you can define as many objects as you please (until you get out of system ram and swap space of course) and can use any subset of them in a particlar scene/frame. You don't get any guarantees that the HW will support all the textures used during a singe frame (you may get thrashing etc.) but the driver will do its best.
Lights present a similar situation, don't they? Sure you may not be able to render with more than a few of them simulataneously in most cases but a given environment may have quite a few of them. Think of a big house. Each room may have one or two lights so on the whole you end up with a bunch of them but mostly one or two will be visible simultaneously. So to handle such a scene I would have to implement the light management myself mapping the visible lights for each frame to the GL_MAX_LIGHTS available "light objects". Ok it probably isn't very hard to do but it bugs me that although all objects (textures, programs, sounds and buffers(openal)) are handled by the various underlying apis I still have to write code to handle lights. If I would have to write a complete object mangagement module that would be a different thing but having just light object management code in the renderer seems annoying. Wouldn't it be better to be able to do glGenLights a few times, then glEnable or glDisable them accordingly, and finally glDeleteLights them? I believe it wouldn't be much wotk for the driver either, so why don't we have anything like this?
Is there a technical reason why although OpenGL used the object approach to handle multiple textures (introduced into the core in version 1.1 I believe?) it stayed with the fixed state approach for lights? I mean with textures you can define as many objects as you please (until you get out of system ram and swap space of course) and can use any subset of them in a particlar scene/frame. You don't get any guarantees that the HW will support all the textures used during a singe frame (you may get thrashing etc.) but the driver will do its best.
Lights present a similar situation, don't they? Sure you may not be able to render with more than a few of them simulataneously in most cases but a given environment may have quite a few of them. Think of a big house. Each room may have one or two lights so on the whole you end up with a bunch of them but mostly one or two will be visible simultaneously. So to handle such a scene I would have to implement the light management myself mapping the visible lights for each frame to the GL_MAX_LIGHTS available "light objects". Ok it probably isn't very hard to do but it bugs me that although all objects (textures, programs, sounds and buffers(openal)) are handled by the various underlying apis I still have to write code to handle lights. If I would have to write a complete object mangagement module that would be a different thing but having just light object management code in the renderer seems annoying. Wouldn't it be better to be able to do glGenLights a few times, then glEnable or glDisable them accordingly, and finally glDeleteLights them? I believe it wouldn't be much wotk for the driver either, so why don't we have anything like this?