Thanks for taking time to read and reply to my question. I really was’nt expecting it.
Well, I want to target as many as possible.
But I’m certain that the graphic card MUST support at least register combiners (which almost every NV cards support, I hope).
I think I’ve cornered myself a bit do, because I also require support for Vertex Object Buffer.
I dont know which cards that support this feature, but I suppose only newer do.
But I will support Display Lists as an alternative too, if time given.
But If I cant get a speed improvement from writing shaders for per-pixel lightning I think it’s a waste of time, or ?
I will, however, have some other shaders too (optional, if card supports them).
Since the program Im writing is for a game contest I want to throw in as much features as possible to impress the jury.
Here is the code for setting up the register combiners :
// Set up texture unit 1 for the 1D radial ramp map texture
// Set up texture unit 0 for the 2D radial map texture
//setup the register combiners to use 1 general combiner
SMALL CODE PART HERE THAT I REMOVED, ALL IT DOES
IS CHANGE THE Mod_Color DEPENDING ON A TIMER FUNCITON
//store the light mod_color
//into the Constant Color 0 register
//setup combiner 1 to calculate the attenuation factor
//(1*Texture0 + 1*Texture1), and store it in the Spare 0 register
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV,
GL_TEXTURE1_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_RGB);
glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB, GL_DISCARD_NV, GL_DISCARD_NV,
GL_SPARE0_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);
//setup the final combiner to calculate (1-Attenuation)*Color
//enable the combiner
// END OF CODE.
I assume that with changing it you mean how often I call this function (the code above is the function “activate_light()”).
I do this for every world-polygon drawn (a polygon that is part of the world, not enemies or items, just the polygons contained in a bsp leaf), I also check if the light can reach the polygon (if not, then that light is’nt considered for the polygon).
After that, the dynamic lightmaps that is created by doing this are blended with the original texture.