I'm currently trying to change indexbuffer of a model with a SetData func, but it remains unchanged...
My general task is to draw certains polygons of a model, what i must to to make it
I found here topic about how to get vertexbuffer of a model, but i still can't set my indices...
Any help would be appreciated :)

How to change Model indexbuffer
Vishal Shah
Yeah, you can get vertices by writing your custom processor.
mike11d11
To get that working, I think you would have to write a custom importer, processor, writer and reader for the ContentPipeline.
LouisVanAlphen
That sounds like a bug: SetData should either work, or throw an exception if you're using it in an incorrect way. If you can provide some code that reproduces this problem, could you attach that to a bug over on the connect site
Regarding selecting only certain polygons, you have many options depending on exactly what you are trying to do:
yabing
Cheers,
Leaf.
jellali
You shouldn't need to write a custom importer: that's only neccessary if you are adding support for a whole new source file format.
Almost always to extend the content pipeline, you only have to write a new processor. If you are adding new data types you may also need to implement a writer and reader, but if you are just altering what data goes into the existing types, the processor is all you need.
Roger McKinney
i don't understand why setdata didnt work...
anyway this is funny
"The XNA Framework Content Pipeline, which is a set of tools that allow developers to more easily incorporate 3D content into their games." - XNA FAQ
in mdx all i needed is load a model and in xna (that helps me save my time!) i need to write my own classes to make things that in mdx i already could use without any problems........
Fox Me Up
the source code is very easy, i just added setdata to standard code that i saw in the xna help:
foreach (ModelMesh mesh in level.Meshes){
foreach (BasicEffect effect in mesh.Effects){
effect.EnableDefaultLighting();
effect.World =
Matrix.Identity;effect.View = mainCamera.ViewMatrix;
effect.Projection = mainCamera.ProjectionMatrix;
}
short[] p = new short[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }; // test arraymesh.IndexBuffer.SetData<
short>(p); // this call do nothing........ no error no result. am i doing something wrongmesh.Draw();
}
and about polygons. i wanna reimplement my octree under xna. all i need is read all vertices postion, than read all triangles (i.e. indices), then build tree. i cant separate level mesh into different parts, coz i dont know what part of my tree will be visible every frame :)
i think i will get vertex and index buffer using technique in this topic http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=891302&SiteID=1 copy it into my class that contains index and vertex buffers and make my own draw calls out of Model class...
---
omg, there is no indexbuffer in modelcontent, so the only way to make what i want is to follow your advice and make custom draw calls using model class. but anyway i need to GET that indices first and i still cant find the way to make it :/
rcurrie
ohhhhh, thx a lot... i should sleep more at night -.- otherwise soon i'll loose even System namespace...