Originally posted by knackered:
What about materials? Do I have to store the materials in a light structure repeatedly for each light, or is there a way of writing into a global set of uniforms?
im not quite sure if i understood the question correctly, but what about writing a material structure which can be passed as parameter to the lighting function of the light structure like this:
What you posted is a partial solution to the situation I described. It works only if there is no overlap in required attributes. What if I have two independant interfaces, and both of them might need some particular attribute in one of their implementations?
The other situation that is not covered in your example is adding additional varying variables. For example, some light models might require the view vector, while others require just the light vector…
This is all a bit confusing. I’ll stick with GLSL for now, I’m comfortable with its compile/link stages and I didn’t have to read a manual to understand it.
i guess in the end it comes down to personal preference and familiarity when deciding which high level language should be chosen.
and yep i guess there are cases where cg just isnt as flexible as glsl. (it was the first language i tried and well… i got used to it ). still i think it does have its merits.