PrimitiveBatch

Jan 25, 2013 at 11:53 PM
Edited Jan 27, 2013 at 3:14 AM

Is the documentation for PrimativeBatch still valid? I tried to implement it to batch faces for my world editor, but nothing is ever drawn. My code:

       

     private PrimitiveBatch facesBatch; 
     private BasicEffectDrawContext effectDrawContext;


      ...

      public Init(GraphicsDevice gr)
      {
           this.facesBatch = new PrimitiveBatch<VertexPositionNormalTexture>(gr);
           this.effectDrawContext = new BasicEffectDrawContext(gr);
      }


       public void Draw( GraphicsDevice gr, Matrix view)
       {
              ...  
                  
              effectDrawContext.BasicEffect.View = view;
              effectDrawContext.BasicEffect.TextureEnabled = true;
              effectDrawContext.BasicEffect.Texture =Template.Texture;

             ...

             this.facesBatch.Begin(QueueingStrategy.Immediate);
             try
             {
                   this.facesBatch.Draw(
                   this.vertices, PrimitiveType.TriangleList, effectDrawContext);
              }
              finally
              {
                   this.facesBatch.End();
              }
       }

Feb 9, 2013 at 1:19 PM
So I ended up writing my own primitive batching system (faces). Not sure why the snippet about did not work. PrimitiveBatch seems like something that should be in XNA core library anyway..