Recently started with shaders. I'm having a problem with a vertex shader.
Assume this simple vertex shader, the box I'm rendering (2x2x2 centered around origo) is rendered stretched across the entire screen (as it should since it's untransformed coordinates, right?)
struct VS_IN
{
float4 Position : POSITION;
};
struct VS_OUT
{
float4 Position : POSITION;
};
VS_OUT main(VS_IN In)
{
VS_OUT Out;
Out.Position = In.Position;
return Out;
}
Now when I try to apply a matrix multiplication to put the vertices in their correct positions the box won't show up at all. The code below should give the same effect as if the shader wouldn't be applied at all, right? Without the shader the box renders fine, but with the shader the box won't show at all. What could be wrong?
struct VS_IN
{
float4 Position : POSITION;
};
struct VS_OUT
{
float4 Position : POSITION;
};
float4x4 Matrix : WORLDVIEWPROJECTION;
VS_OUT main(VS_IN In)
{
VS_OUT Out;
Out.Position = mul(In.Position, Matrix);
return Out;
}