C#.net Effect Class and Fx Files Error

Started by
1 comment, last by kiza 14 years, 4 months ago
Hi , I am using managed DirectX and C#.net , when i Run program , the program throws an error : " Error in Application..." and highlights below line :
effect = Effect.FromFile(dev, @"..\..\simple.fx", null, ShaderFlags.None, null);
and here is simple.fx :

// Shader output, position and diffuse color
struct VS_OUTPUT
{
    float4 pos  : POSITION;
    float4 diff : COLOR0;
};

// The world view and projection matrices
float4x4 WorldViewProj : WORLDVIEWPROJECTION;
float Time = 1.0f;

// Transform our coordinates into world space
VS_OUTPUT Transform(
    float4 Pos  : POSITION)
{
    // Declare our return variable
    VS_OUTPUT Out = (VS_OUTPUT)0;

    // Transform our position
    Out.pos = mul(Pos, WorldViewProj);
    // Set our color
    Out.diff.r = 1 - Time;
    Out.diff.b = Time * WorldViewProj[2].yz;
    Out.diff.ga = Time * WorldViewProj[0].xy;

    // Return
    return Out;
}
technique TransformDiffuse
{
    pass P0
    {
        CullMode = None;

        // shaders
        VertexShader = compile vs_1_1 Transform();
        PixelShader  = NULL;
    }
}

Advertisement
okay , I have solve it myself ; and the error cause by this reason
that we should create are effect in our render function .
<in Timer.> or <form_paint>
.
I still have the same problem and i don't see solution... can anybody help me? I use "Managed DirectX 9: graphics and game programming" by Tom Miller.
Btw, i would be very grateful if someone can give msn or skype contact to me. It will not be so much wasting of time, just to show me where the problem is when i stop at some point and i can't continue..

This topic is closed to new replies.

Advertisement