Sign in to follow this  

[slimdxvisual basic]end of stream exception writing mesh buffer

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

Hi i am trying to create a mesh, first i have created my fvf: Public Structure CustomVertexPositionTextured Public Position As Vector3 Public texture As Vector2 Public Shared ReadOnly vertexformat As SlimDX.Direct3D9.VertexFormat = vertexformat.Position Or vertexformat.Texture1 End Structure i don´t put all the code only the things that maybe you need to help me, then i have created the vertexdata: Dim verticest As CustomVertexPositionTextured() = New CustomVertexPositionTextured(2992) {} and i have fill it with the data of the vertices Dim malla As New Mesh(device, 2967, 2993, MeshFlags.Dynamic, VertexFormat.Position Or VertexFormat.Texture1) Dim datast As SlimDX.DataStream = malla.VertexBuffer.Lock(0, 0, LockFlags.None) datast.Seek(0, IO.SeekOrigin.Begin) datast.WriteRange(verticest, 0, verticest.Length) Finally i have created the mesh and when i try to fill the vertexbuffer of the mesh i get an endofstream exception i the line: datast.WriteRange(verticest, 0, verticest.Length) [Edited by - jor1980 on February 25, 2010 9:35:37 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Buckeye
I'm not a slimdx person, but, if WriteRange has a zero offset, try:

datast.WriteRange(verticest, 0, verticest.Length-1)


I have tried but it also gives me the same error, Anyother idea?

Thank´s

Share this post


Link to post
Share on other sites
i think that i have solved it changing:

datast.WriteRange(verticest, 0, verticest.Length)

for this:

datast.WriteRange(verticest)

but now it gives me the same error as before in this:

Dim dataindstr As SlimDX.DataStream = malla.IndexBuffer.Lock(0, malla.IndexBuffer.Description.SizeInBytes, LockFlags.None)

dataindstr.Seek(0, IO.SeekOrigin.Begin)
dataindstr.WriteRange(indices)

Share this post


Link to post
Share on other sites
Quote:
Original post by jor1980
i think that i have solved it changing:

datast.WriteRange(verticest, 0, verticest.Length)

for this:

datast.WriteRange(verticest)

but now it gives me the same error as before in this:

Dim dataindstr As SlimDX.DataStream = malla.IndexBuffer.Lock(0, malla.IndexBuffer.Description.SizeInBytes, LockFlags.None)

dataindstr.Seek(0, IO.SeekOrigin.Begin)
dataindstr.WriteRange(indices)


I have solved with this:
dataindstr.WriteRange(indices, 0, indices.Length - 1)

but i have a question, Why indices.length -1 if the indexbuffer has a length of indices.length *2(maybe beacuse indices are a short´s array)

Share this post


Link to post
Share on other sites

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