Sign in to follow this  

Weird Issue With CG Runtime

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

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