Advertisement

Using basic effect in 2D monogame

Started by June 07, 2015 02:11 PM
-1 comments, last by FearNotThisNight 9 years, 7 months ago

I was trying to use basic effect to view a plain 2D texture.


  world = Matrix.CreateTranslation(0f, 0.0f, 0.0f);
  view = Matrix.CreateLookAt(new Vector3(1f, 1f, 0), new Vector3(0, 0, 0), Vector3.Up);
  projection = Matrix.CreateOrthographic(1f, 1f, 0.1f, 1000f);

     effect.World = world;
            effect.View = view;
            effect.Projection = projection;
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, effect);             
spriteBatch.Draw(player,new Vector2(0,0),Color.White );             
spriteBatch.End();

T

he code for basic effect is used mostly on 3D i think.

But i saw this site, which you can use basic effect in spritebatch so I thought I could use 2D in here

But still I am getting a blank screen.

Does anyone know how to load up a texture 2D using view, world and projection matrix? Is it even posible to do it?

This topic is closed to new replies.

Advertisement