in Cg, can't find tex2D?

Started by
0 comments, last by kRogue 18 years, 11 months ago
I have the following Cg code:
void main(in float2 c : WPOS,
	    uniform sampler2D tex1,
	    out float3 oColor : COLOR0)
{
	float sum = 0.0;
	for(int x = 0; x < 3; x++)
	{
		for(int y = 0; y < 3; y++)
		{
			float2 f=x,y;
			float3 a=tex2D(tex1, f);
			sum =sum + a.x;
		}
	}	
	oColor=sum;
}
I'm getting the following error: unable to find compatible overloaded function "tex2D". Has anyone ever gotten this error? Thanks. -Nick
Advertisement
How aer you compiling the code? if you are using the command line compiler (cgc) you need to specify a profile that supports texture lookups (like any framgent shader profile)... try to compile it with the command: (this is for GeForeceFX's architecture) (use fp20 for GeForce4, and fp40 for GeForce6 [ -fp20 for compatibility fp40 for high end speed on high end systems] )

cgc -profile fp30 sourceFile

I think cgc defaults to some vertex shader profile...

Close this Gamedev account, I have outgrown Gamedev.

This topic is closed to new replies.

Advertisement