Jump to content
  • Advertisement
Sign in to follow this  

Weird Issue With CG Runtime

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

Hey guys!  I am integrating the CG Runtime into my game engine but I am running into a strange issue.

My engine only supports loading cgfx.  I wrote the following shader as a test

struct VS_INPUT
      float4 position  : POSITION;
      float4 normal    : NORMAL;
struct VS_OUTPUT
      float4 color   : COLOR0;
      float4 position  : POSITION;
VS_OUTPUT myvs( uniform float4x4 ModelViewProj, const VS_INPUT vin)
        VS_OUTPUT vout;
        float4 position = mul(ModelViewProj, vin.position) * 5.0;
        vout.position = position;
        vout.color = float4(1,0,0,1);
        return vout;
float4x4 mvp    :       WorldViewProjection;
technique main
        pass p0
                Zenable = false;
                ZWriteEnable = false;
                VertexProgram = compile vs_1_1 myvs( mvp );

When running, I can visually see that the ZEnable state is disabled but my 3d model is not showing up as red.  The vertex program that I wrote should have shaded my model red.  I am doing the following to render my model


cgSetPassState( this->pass );
// Send Verts and normals to directx
mpDev->DrawPrimitiveUP(D3DPT_TRIANGLELIST, 1, t, sizeof(CUSTOMVERT));
cgResetPassState( this->pass );



Will the cgSetPassState also invoke the VertexProgram or is there something else I need to do to invoke it?  Thanks!

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!