• Advertisement

Archived

This topic is now archived and is closed to further replies.

Rendering using my own vertex format (managed DX)

This topic is 5512 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''ve got some code problems, it seems like the error occours on my Lock-Call for my vertex-buffer... please take a look at my code below, thank you! ''My vertex structure Public Structure myVertFormat Dim x As Single Dim y As Single Dim z As Single Dim tx As Single Dim ty As Single Public Const myVFfvf As VertexFormats = VertexFormats.Position Or VertexFormats.Texture0 Public Const myVFsize As Long = 20 Public Sub New(ByVal nX As Single, ByVal nY As Single, ByVal nZ As Single, ByVal nTX As Single, ByVal nTY As Single) Me.x = nX Me.y = nY Me.z = nZ Me.tx = nTX Me.ty = nTY End Sub End Structure ''Create the VB vbCube = New VertexBuffer(D3DDev, myVertFormat.myVFsize * 36, Usage.WriteOnly, myVertFormat.myVFfvf, Pool.Managed) ''...and Lock it Dim vCube As myVertFormat() = CType(vbCube.Lock(0, LockFlags.None), myVertFormat())

Share this post


Link to post
Share on other sites
Advertisement
This looks like nearly the same problem another poster was having with index buffers: http://gamedev.net/community/forums/topic.asp?topic_id=135054

If you create a VertexBuffer or IndexBuffer using one of the constructors that doesn''t take a Type parameter, then when you Lock you must either 1) use the Lock method that *does* take a Type, or 2) use the Lock that returns a GraphicsStream. In order for Lock to return an Array, it has to know the type of the elements in the array. If it never gets that information, it can''t create it.

At least that''s my understanding at this point. I don''t know if this is by design (and will eventually be documented) or if it''s a bug.

Share this post


Link to post
Share on other sites

  • Advertisement