HELP : Compiling .fx shader

Hello all monogame community ! I ask help here just how to compiling my fx vertex shader to windows ? I asked at gamedev here : http://gamedev.stackexchange.com/questions/86783/monogame-vertex-shader-loading-problem
But anyone seems interested to answer me…
So I’m asking here just how to get simply working my vertex shader I’m pretty sure it’s not really hard … Thank you :wink:

EDIT : Ok i GOT news , I uninstall monogame and install the latest dev version of November 4 2014, I succesfull compiling my shader :

sampler TextureSampler : register(s0); float2 ViewportSize; float4x4 ScrollMatrix;

void SpriteVertexShader(inout float4 color : COLOR0, inout float2 texCoord : TEXCOORD0, inout float4 position : POSITION0) { // Half pixel offset for correct texel centering. position.xy -= 0.5;

// Viewport adjustment.
position.xy = position.xy / ViewportSize;
position.xy *= float2(2, -2);
position.xy -= float2(1, -1);

// Transform our texture coordinates to account for camera
texCoord = mul(float4(texCoord.xy, 0, 1), ScrollMatrix).xy;
}

technique SpriteBatch { pass { VertexShader = compile vs_4_0_level_9_1 SpriteVertexShader(); } }

i got a xnb file that i try to load with content.load(…) It work, but then when I want to use it within my spriteBatch Begin, it throw me sharpDX error : HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: Incorrect par…

my SpriteBatch Begin: spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null, InfiniteBG);

1 Like

This is because you’re not being clear with your problem. You post on StackExchange talks more about what tutorial your following, how long you’ve looked around, the alternatives you’ve tried, and your disappointment than actually describing your problem.

This is all I could figure out from your StackExchange post:

  1. You are trying to compile a custom effect.
  2. You got an error.

This isn’t enough to figure out your problem… we need specifics.

  • Show me your actual .fx file.
  • What is the error message you got.
  • What platform are you targeting with your effect?
  • What version of MonoGame are you using… the 3.2 release? The latest development installer?

Yea i applogize for Such a short and un clear answer it’s just because I writted quickly I didn’t have time , I edited my post on stack exchange , I’m new to game dev , that why i follow a tutorial but I’m not new to programming through, for the shader file it’s the same as the tutorial , I focus on windows platform / DirectX , stable monogame used : 3.2