I'm trying to use a pixel shader to display an image. I've searched around for information on how to do this, and I found this:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb219690%28v=vs.85%29.aspx
Here is the hlsl script from there:
texture MyTexture;
sampler MySampler =
sampler_state
{
Texture = <MyTexture>;
MinFilter = Linear;
MagFilter = Linear;
AddressU = Clamp;
AddressV = Clamp;
};
float4 TextureLookupPS( float2 vTexCoord : TEXCOORD0 ) : COLOR
{
return tex2D( MySampler, vTexCoord );
}
For the main function, I guess I do this:
PS_OUTPUT psmain(in VS_OUTPUT In)
{
PS_OUTPUT Out;
Out.Color = tex2D(mySample, In.texture);
return Out;
};
In C++, how do I pass in the value of MyTexture? Do I load an IDirect3DTexture9* with D3DXCreateTextureFromFile? How do I get that information to the pixel shader?