Cannot compile cg shader

Started by
1 comment, last by Jaenis 13 years, 3 months ago
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?
Advertisement
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
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.

This topic is closed to new replies.

Advertisement