Sign in to follow this  

[.net] Problem rendering Mesh in Managed DirectX and C#

This topic is 4688 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been toying around with C# and Managed DirectX for a bit and I've come across a problem that I'm not sure how to solve... when I setup a vertex buffer and index buffer and then render it using device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, WIDTH * HEIGHT, 0, numberVerts * 6); it renders fine, if I put the vertex buffer and the index buffer in a mesh, then it looks like the index buffer is not being rendered as a TriangleList... basically all triangles connect to the first vertex... as if it was a TriangleFan... Does anyone know if there is a way to set the PrimitiveType for a Mesh? Thanks for your help and let me know if you need to see more code or screenshots of what is wrong.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I do not know how to change the primitive type used by mesh, but I build meshes all the time with triangle lists and they work fine. It could be a problem with the index data itself. Are you using a 16bit or 32bit index? If you are using a 32bit index you must specify the Use32Bit mesh flag on creation.

Share this post


Link to post
Share on other sites
The index data itself is fine as it renders ok when I do DrawIndexedPrimities... I was able to get it to work with the mesh by increasing the heightfield from 256x256 to 257x257... though performance of the mesh is terrible compared to using a vertex and index buffer... and yes, when I use larger datasets I am using 32bit indexes...

I will have to look into dynamically splitting the landscape into smaller pieces... hopefully that will solve the performance issue...

Thanks for your reply

Marcel Isler
aka GoodFun
aka ShadowHawk

Share this post


Link to post
Share on other sites

This topic is 4688 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this