Jump to content

  • Log In with Google      Sign In   
  • Create Account


XNA BasicEffect Translation Issue


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 ShadowMan777   Members   -  Reputation: 361

Like
0Likes
Like

Posted 04 January 2013 - 10:33 PM

Hello. I am drawing 2 objects at the origin using XNA's basic effect, yet somehow, they are being drawn next to eachother.I know they are both being drawn at the origin. I am assuming that the effects of the previous draw is cummulative somehow, but I don't know why. Here is a pic of the issue.  

 

http://imgbin.org/index.php?page=image&id=11011

 

 

Here is the draw function

 

 

 
        public virtual void DrawEntity(BasicEffect effect, GraphicsDevice gd,int debugx=0,int debugy=0)
        {
    
          Matrix test = Matrix.CreateWorld(new Vector3(0,0,0), Vector3.Forward, Vector3.Up);
     
             effect.TextureEnabled = true;
             effect.World= test;
             effect.View = Camera.Singleton.viewMatrix;
             effect.Projection= Camera.Singleton.projectionMatrix;
             effect.Texture= texture;
             gd.SetVertexBuffer(vertexBuffer);
             gd.Indices = indexBuffer;
             
            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                gd.DrawIndexedPrimitives(PrimitiveType.TriangleList,
                    0, 0, vertexBuffer.VertexCount, 0, 2);
            }
 
        
        }
 

 

And my main xna draw function.

 

     protected override void Draw(GameTime gameTime)
        { 
            GraphicsDevice.Clear(Color.Black);  
            Player.Singleton.DrawEntity(effect, GraphicsDevice); 
            map.EntityList[0].DrawEntity(effect, GraphicsDevice);
              
            DrawText();
            base.Draw(gameTime); 
            IncrementFrameCounter();
        }

 

 

Any ideas? Thanks.


Edited by ShadowMan777, 04 January 2013 - 10:34 PM.


Sponsor:

#2 DpakoH   Members   -  Reputation: 934

Like
0Likes
Like

Posted 05 January 2013 - 03:01 AM

if you upload your project i could take a look






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS