I don’t know if I understand what you are asking clearly enough to answer your questions.
I don’t see any obvious problems in the syntax. Whether it’s “correct” is, of course, a much more abstract question that I cannot answer.
I don’t know what you mean. You can store any PT(RenderAttrib) objects you like. You don’t need a separate one for each shader variable, but I guess you could store them that way if you wanted to.
I don’t know what matrices you are looking for here, so how can I tell you how to get them?
I was refering to the syntax indeed.
And I wanted to know if it is correct to set all my shader inputs on the same render attribute or if I should store a PT(RenderAttribute) for each shader input variable.
in directx I would usually set the shader variables on each “render” call - but panda hasn’t got a render call as such (so I will be doing it in my “update” loop).
In direct X I would get the handle to those shader variables and just set them through the handle.
You can store them all in the same ShaderAttrib object; that’s the intended way to do it. But you might find it easier to use NodePath::set_shader_input(), which is a higher-level interface, instead constructing a ShaderAttrib laboriously by hand like you are doing.
It looks like you are loading the identity matrix for what you are calling “world”? In Panda, the identity matrix is LMatrix4f::ident_mat().
I guess you are computing the composition of the camera’s net transform and its lens’s projection mat for what you are calling “viewProjection”? Normally, Panda would do this for you; and if you use Cg, you can have Panda automatically compute the transform using the naming convention as described in the manual. Since you are re-using an existing shader, though, you can do something like camera.node()->get_lens()->get_projection_mat() * camera.get_net_transform()->get_mat() for this matrix. You might have to experiment to get precisely the value you are looking for. I can’t tell you precisely what you need to type since what you are doing is very specific to your own application.