@willmotil wrote:
Ok i haven't done any shader stuff with spritebatch in monogame so i basically wanted to give it a shot. I used yesterdays build, created a default fx using the pipeline tool, added a image and a sprite font, dropped in the basic code i thought used to work in 4.0 but,,, Im getting nothing drawing. The background is cleared but text and image disappear..
What am i missing here ?
` public class Game1 : Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; SpriteFont myfont; Effect myeffect; Texture2D tpic01; public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } protected override void Initialize() { base.Initialize(); } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); myfont = Content.Load<SpriteFont>("MyFont"); myeffect = Content.Load<Effect>("MyEffects"); tpic01 = Content.Load<Texture2D>("tpic01"); } protected override void UnloadContent() { } protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); //spriteBatch.Begin(); // drop in my effect and text and image disappear. spriteBatch.Begin(0, BlendState.NonPremultiplied, null, null, null, myeffect); spriteBatch.Draw(tpic01, new Rectangle(100, 100, 300, 300), Color.White); spriteBatch.DrawString(myfont, "hello", new Vector2(20, 20), Color.AntiqueWhite); spriteBatch.End(); base.Draw(gameTime); } }
,,,,,, the basic stuff the pipeline tool outputs for a fx file it shouldn't change anything
`SV_POSITION POSITION VS_SHADERMODEL vs_3_0 PS_SHADERMODEL ps_3_0
matrix WorldViewProjection; struct VertexShaderInput { float4 Position : SV_POSITION; float4 Color : COLOR0; }; struct VertexShaderOutput { float4 Position : SV_POSITION; float4 Color : COLOR0; }; VertexShaderOutput MainVS(in VertexShaderInput input) { VertexShaderOutput output = (VertexShaderOutput)0; output.Position = mul(input.Position, WorldViewProjection); output.Color = input.Color; return output; } float4 MainPS(VertexShaderOutput input) : COLOR { return input.Color; } technique BasicColorDrawing { pass P0 { VertexShader = compile VS_SHADERMODEL MainVS(); PixelShader = compile PS_SHADERMODEL MainPS(); } };`
Posts: 1
Participants: 1