I'm using visual studio c++ 2012 on windows 7 and directx 10. I copied the code from the tutorial in the directx sdk documention which produces a flat triangle on screen. I can successfully compile the code and see the result but when I sent the .exe and necessary .fx file to other computer, the user on the other side encountered a problem that the window appears and disappeared quickly after clicking the .exe. I've installed c++ redistributed 2012 x86 update 3 on that computer but it seems that's not where problem is.
Here's the shader code:
struct vin // The input to vertex shader
{
float4 pos : POSITION;
float4 col : COLOR;
};
struct vout // The output of vertex shader and input of pixel shader
{
float4 pos : SV_POSITION;
float4 col : COLOR;
};
//
// Vertex Shader
//
vout VS( vin Vin )
{
vout Vout;
Vout.pos = Vin.pos;
Vout.col = Vin.col;
return Vout;
}
//
// Pixel Shader
//
float4 PS( vout Vout) : SV_Target
{
return Vout.col;
}
technique10 Render
{
pass P0
{
SetVertexShader( CompileShader( vs_4_0, VS() ) );
SetPixelShader( CompileShader( ps_4_0, PS() ) );
}
}
And since the source code is too long, I added it as an attach file.