Jump to content
  • Advertisement
Sign in to follow this  
mlt

Cannot compile cg shader

This topic is 2763 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
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

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
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!