Original Post
Hi all, it's the first time i use vertex and pixel shaders. I tried the shaders out of the minimal interface example in the file cgRuntime.chm from the CG language. The vertex shader compiles fine. But i get the following erros when compiling the pixelshader: D:\Program Files\NVIDIA Corporation\Cg\bin>cgc.exe SimpleDiffusePS.CG -entry Pix elShader -profile arbfp1 SimpleDiffusePS.CG SimpleDiffusePS.CG(18) : error C1101: ambiguous overloaded function reference "t ex2D" d:\bld\cg\rel1.4\src\cglang\stdlib\fp30_texture.cg(17) : arbfp1 float4 tex2D (sampler2D, float3) d:\bld\cg\rel1.4\src\cglang\stdlib\fp30_texture.cg(15) : arbfp1 float4 tex2D (sampler2D, float2) SimpleDiffusePS.CG(18) : error C1022: operands to "mul" must be numeric Here's the pixelshader(straight from the documention from CG): When i look into the CG toolkit.pdf i see there's only a tex2D function that takes a float3 or a float2. So is the example pixelshader which takes an float4 wrong?? thx in advance [Edited by - codehunter13 on September 13, 2005 9:37:08 AM]
struct Vert
{
float4 pos : POSITION;
float4 dif : COLOR0;
float4 tex : TEXCOORD0;
};
struct Pix
{
float4 dif : COLOR0;
float4 tex : TEXCOORD0;
};
Pix PixelShader(const Pix In, const uniform sampler BaseTexture,
const uniform float4 SomeColor)
{
Pix Out;
Out.dif = In.dif * tex2D(BaseTexture, In.tex) + SomeColor;
return Out;
}