Advertisement Jump to content
Sign in to follow this  

Cannot compile cg shader

This topic is 2946 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:

(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 -profile vs_2_0 -entry main_plain_texture_vp
cgc -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:
Original post by mlt
void main_plain_texture_vp( <-- never closed
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
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!