Jump to content
  • Advertisement
Sign in to follow this  

Problem reading mesh vertices

This topic is 4634 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

hey guys i am using this function to get vertex data from a mesh but i am having an error when i want to use these vertexs so i don't get the same result of the original mesh vertexs the vertexs are arranged like circles but not like the ellipse mesh i have plz see this sourse for the function i used and the pictures that shows 1st the vertexs as points and the ellipse that i took the vertex from it which is around the car and in the 2nd picture see when i draw the triangles of the vertexs in white collor it gave me a terrible shape
private PositionNormalTexVertex[] vbData;
		public struct PositionNormalTexVertex
			public Vector3 Position;
			public Vector3 Normal;
			public  float Tu0, Tv0;
			public static readonly VertexFormats FVF = VertexFormats.Position | VertexFormats.Texture1;
		public void ArrayBasedReadWrite()
			//Create a vertex buffer in the managed pool
			VertexBuffer vb = BoundMeshClass.mesh.VertexBuffer;
			//Fill an array of the appropriate type with the VB data using Lock()
			//This lock overload simply locks the entire VB -- setting ReadOnly can improve perf when reading a vertexbuffer
			vbData = vb.Lock(
				0, typeof(PositionNormalTexVertex), 
				LockFlags.None, BoundMeshClass.mesh.NumberVertices) as
			//Unlock the buffer

1.jpg 2.jpg [Edited by - Muhammad Haggag on November 13, 2005 2:47:16 AM]

Share this post

Link to post
Share on other sites
Are you sure that the mesh data you are locking is in the same format as you're extracting? if it isn't then you'll get all sorts of funky corruption [grin]

Check the FVF you're using against the one that the mesh reports; if they're *not* the same then you've found your problem.

Secondly, meshes tend to have index buffers to arrange the vertices into actual triangles - which is probably part of the reason why you're getting a complete mess when you try to render the vertex data as triangles (second picture).


Share this post

Link to post
Share on other sites
You have managed to skillfully ignore not only the sticky rules thread and the Forum FAQ, but also common sense. There's nothing important about your thread. It's a thread, like every other thread. Except it's given a meaningless title.

Thread closed. Don't try to create another on the same problem, because I'll delete it. Read the rules. And follow them.

EDIT: Now that you've hopefully read the rules, thread re-opened. However, the next time you break the rules, I will suspend you.

[Edited by - Muhammad Haggag on November 13, 2005 2:27:20 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!