title: Drawing different Textures with a single Basic Effect, XNA 4.0
body: <p>I have a problem in the game I wrote with XNA. I recently added Textured polygons, and saw that every textured polygon shared the same texture although I changed it before calling. The code I am using:</p>
  
  
  
  <pre class="lang-cs prettyprint-override"><code>      if (countMeshes &gt; 0)
          {
  
              for (int i = 0; i &lt; countMeshes; i++)
              {
  
                  TexturedMesh curMesh = listMeshes[i];
  
                  if (curMesh.tex == null)
                  {
  
                      drawEffect.Texture = WHITE_TEXTURE;
  
                  }
                  else
                  {
                      drawEffect.Texture = curMesh.tex;
                  }
  
                  drawEffect.Techniques[0].Passes[0].Apply();
                  graphics.DrawUserPrimitives(PrimitiveType.TriangleList, curMesh.verts, 0, curMesh.count);
  
              }
          }
  </code></pre>
  
  <p>Now, the first that came into my mind would be to create a BasicEffect for each Texture I need to draw. But I think that would be a bit of a overkill so my question is: How should I do it?</p>
  
  <p>PS: I double checked everything, the UV Coords are fine, and it is 2D.</p>