sampler3D parameter name [SOLVED]


I’m trying to pass a 3-D texture to a fragment shader, so I took a look to the list of possible shader inputs and I found this:

But no parameter name is specified…

What parameter name is meant to be used to pass a sampler3D as a parameter to a fragment shader?


In my shaders i have :

in uniform samplerCUBE k_skybox : TEXUNIT4,  

in my python i have:


Oh I get it! I thought that the parameter names that appear in the list of possible shader inputs where the only ones that could be used, since I tried something like this:

void fshader(uniform sampler3D texture)

And I got an error telling me that my parameter name was not valid. So is there any kind of convention for shader parameter names?

Why is it that in your example, in the shader you use “k_skybox”, but in python you only use “skybox”?

Custom shader inputs are prefixed with k_ in the shader.

So the only obligatory part is the “l_”, “o_”, “k_”, depending on the case. The following part of the identifier can be whatever I want. Am I right?

Yes, that should be correct, if they are valid Cg variables. Not 100% sure about underscores, but I think they should work.

Note that shader inputs passed from your program always have the k_ prefix. By convention, l_ inputs are the ones passed from the vertex shader to the fragment shader, and o_ variables the output from a fragment shader, but in practice you can mix the two.

Note that you can’t use k_ variables without assigning a shader input to them.

Excellent! Thanks once again!