I'm trying to understand 3D rendering and it seems that everytime you render a new object (A 3D Cube or something) you need to have a new BasicEffect for each Box you render unless you want the exact same texture?
...so if I have over a hundred boxes with each different textures, I need at least as many BasicEffects? Will that not be "too much" for the CPU/GPU in the end or result in lagging? Is there any good way to render multiple objects (cubes or other shapes) at the same time?
I've tried changing the BasicEffect.Texture with each cube drawn, but it resulting in changing the first Cube's texture too.
Any suggestions would be really appreciated, I'm really new to 3D in XNA so I'm trying to wrap my head around the best methods for example render a Map with objects (of shapes).
Example: I create some Cube3D (by providing location and size) and it creates a list of Vertices.
I have to render it this way:
gameEffect.TextureEnabled = true;
gameEffect.Texture = gameTexture;
gameEffect.EnableDefaultLighting();
foreach (EffectPass pass in gameEffect.CurrentTechnique.Passes)
{
pass.Apply();
foreach (Cube3D cube in gameCubes)
{
cube.Render(GraphicsDevice);
}
}
...thereby having the same Texture on each Cube. Are there any other ways?