Sign in to follow this  

Cannot compile cg shader

This topic is 2548 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 shader (from the Ogre website):



void main_plain_texture_vp(
// Vertex Inputs
float4 position : POSITION, // Vertex position in model space
float2 texCoord0 : TEXCOORD0, // Texture UV set 0

// Outputs
out float4 oPosition : POSITION, // Transformed vertex position
out float2 uv0 : TEXCOORD0, // UV0

// Model Level Inputs
uniform float4x4 worldViewProj)
{
// Calculate output position
oPosition = mul(worldViewProj, position);

// Simply copy the input vertex UV to the output
uv0 = texCoord0;
}

void main_plain_texture_fp(
// Pixel Inputs
float2 uv0 : TEXCOORD0, // UV interpolated for current pixel

// Outputs
out float4 color : COLOR, // Output color we want to write

// Model Level Inputs
uniform sampler2D texture) // Texture we're going to use
{
// Just sample texture using supplied UV
color = tex2D(texture, uv0);
}


when I compile it through the commandline (using Cg Toolkit 2.2) on windows 7 I get:

C:\local\OgreSDK_vc10_v1-7-2\media\mystuff>cgc GameObjStandard.cg
GameObjStandard.cg
(0) : error C3001: no program defined
32 lines, 1 errors.

Any ideas? Is there someway of getting better error into when using cgc?

Share this post


Link to post
Share on other sites
you didn't specify a profile and an entry function. Try
cgc GameObjStandard.cg -profile vs_2_0 -entry main_plain_texture_vp
and
cgc GameObjStandard.cg -profile ps_2_0 -entry main_plain_texture_fp

Share this post


Link to post
Share on other sites
At least these two opening parenthesis were never closed:
Quote:
Original post by mlt
void main_plain_texture_vp( <-- never closed
<snip>
void main_plain_texture_fp( <-- never closed

There is a missing ')' somewhere.
Prob one just before fragment shader and one at the end.

Share this post


Link to post
Share on other sites

This topic is 2548 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this