Shader uniform parameter

Hi!

Is it possible to pass a data type as a uniform parameter to a shader that’s not a float4 or float4x4? In particular is it possible to pass a single float like this?

void fshader(uniform float k_depth) 

When I run my game, I get the following error:

Thanks!

I also need to be able to pass this same float to both the vertex shader and the fragment shader. How can this be accomplished? The call “model.setShaderInput()” to which program applies?

Thanks!

Just use setShaderInput(). You can pull it from any part IIRC.

panda3d.org/dox/python/html/ … 81c60f1eea

You can just pass a float4 if you want to pass a float. I think I’ve checked in a fix recently that allows you to use float, float1, float2, float3 as well.

Great! Thanks for both answers…

I’ll just pass a float4 for now, and wait for the next Panda version, in order to be able to pass a single float.

Cheers!