Jump to content
  • Advertisement
Sign in to follow this  
nickwinters

in Cg, can't find tex2D?

This topic is 4865 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!