First of all, sorry for my poor English.
I have a doubts using shaders. I have no problem rendering a unique SceneNode with a shader. But I dont know how to render many SceneNodes using the same shader AND using different shader parameters for each SceneNode. I can modify shader parameters only one time per frame (using callback method), so all attached SceneNodes will be rendered with the same parameters.
One solution could be create one shader (with same code) per SceneNode, but I have a lot of objects in my SceneGraph. Is there any way to modify shader parameters por each SceneNode in the same frame? I have read something about override the "render ()" method, but it could be a litte trouble...
Thanks a lot.
How could I use a same shader attached to various nodes?
From what I know, this isn't possible. You *could* create a new scenenode object and (as you mentioned) change the render function to set the material's values before rendering, but really you might as well have separate materials for each object. There isn't a huge amount of overhead from doing so (textures will only be stored once).
Remember that values can also be sent to shaders through vertices (colour, normals, UV, etc.) which may be a better solution if they're animating anyway.
Remember that values can also be sent to shaders through vertices (colour, normals, UV, etc.) which may be a better solution if they're animating anyway.