Click here to Skip to main content
15,887,436 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have xna 3.1 how do i load multiple models in xna 3.1 for rendering either from array or button click or switches anything i just need to load multiple 3d models to render

this is the link
http://xboxforums.create.msdn.com/forums/p/15459/80961.aspx[^]

where i get code but this code is in 4.0

C#
Model[ ] modelArray;

protected override void LoadContent() {
  modelArray = new Model[3];
 modelArray[0] = Content.Load<Model>("model1");
 modelArray[1] = Content.Load<Model>("model2");
 modelArray[2] = Content.Load<Model>("model3");
}

 protected override void Draw(GameTime time) {

   GraphicsDevice.Clear(Color.LightBlue);
   foreach (Model m in modelArray) {
  foreach (BasicEffect be in m.Effects) {
    be.World = YOURWORLDMATRIX;
    be.View = YOURVIEWMATRIX;
    be.Projection = YOURPROJECTIONMATRIX;
    }
  m.Draw();
     }
  base.Draw(time);
    }





nd i have XNA 3.1 error occur in this line they show me error

ERROR1:'Microsoft.Xna.Framework.Graphics.Model' does not contain a definition for
'effects' and no extension method 'effects' accepting a first argument of type
'Microsoft.Xna.Framework.Graphics.Model' could be found (are you missing a
using directive or an assembly reference?)

AND ALSO SAME ERROR COME IN DRAW

'Microsoft.Xna.Framework.Graphics.Model' does not contain a definition for 'draw'
and no
extension method 'draw' accepting a first argument of type
'Microsoft.Xna.Framework.Graphics.Model' could be found (are you missing a using
directive or an assembly reference?)

in this lines

m.Effects
m.Draw();
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900