Hello! New here, new to Panda, and new to Cg (though I’m a bit familiar with HLSL). I’m trying to write a shader, and everything was going fine when I was using the vertex colors. But now that I’m trying to use some textures that I want to choose with “setShaderInput”, apparently I’m not understanding the syntax on the Cg side of things.
My Pixel shader definition looks something like this:
void fshader
(
float3 l_worldnormal : TEXCOORD0,
float3 l_worldview : TEXCOORD1,
float3 l_lightvec : TEXCOORD2,
float2 l_uv : TEXCOORD3,
out float4 o_color : COLOR,
uniform sampler2d k_colorLo,
uniform sampler2d k_colorHi,
uniform float4 k_lightDir,
uniform float4 k_gradProps,
uniform float4 k_specProps
)
{
// ...
}
and the compiler is throwing a fit over the two ‘sampler2d’ lines, saying this:
:gobj(error): testShader.sha (43) : error C0000: syntax error, unexpected identifier at token "sampler2d"
:gobj(error): testShader.sha (43) : error C0501: type name expected at token "sampler2d"
:gobj(error): testShader.sha (44) : error C0000: syntax error, unexpected identifier at token "sampler2d"
:gobj(error): testShader.sha (44) : error C0501: type name expected at token "sampler2d"
:gobj(error): testShader.sha (43) : error C0000: syntax error, unexpected identifier at token "sampler2d"
:gobj(error): testShader.sha (43) : error C0501: type name expected at token "sampler2d"
:gobj(error): testShader.sha (44) : error C0000: syntax error, unexpected identifier at token "sampler2d"
:gobj(error): testShader.sha (44) : error C0501: type name expected at token "sampler2d"
I’m not sure what I’m doing wrong, it looks to me like the example here…
Any idea what I’m doing wrong? It’s probably something obvious… (If there’s a simpler way to get multiple textures to a shader, that’s fine too!)
Thanks!