Sign in to follow this  
vidalsasoon

DX(.NET 2.0) - Getting VertexBuffer positions from a mesh

Recommended Posts

I could get the VertexBuffer positions with .NET 1.0... /* .NET 1.0 PositionNormalTextured[] lockedVerts = mesh.LockVertexBuffer( typeof(PositionNormalTextured), LockFlags.None, mesh.NumberVertices) as PositionNormalTextured[]; */ Using .NET 2.0, "LockVertexBuffer(...)" only returns a GraphicsBuffer so i'm now a little lost on what to do. // this compiles but how to get the positions of my vertices? graphicsBuffer = mesh.LockVertexBuffer<PositionNormalTextured>(LockFlags.None); My experience with Generics is limited to a few hours... I assume somehow getting the data from the "graphicsBuffer" will give data of type "PositionNormalTextured"?

Share this post


Link to post
Share on other sites
I just had a look in the MDX documentation (still a painful experience I find).

this page (on Vertex Buffers) has a code fragment at the bottom seems to indicate a couple of ways of getting at the data.

In general, the GraphicsStream.InternalData property seems to be what you need to look into.

hth
Jack

Share this post


Link to post
Share on other sites
At a guess, your now using MDX for .NET 2 - right? If so, graphicsstream now uses generics for this (yay for less casts!)

Share this post


Link to post
Share on other sites
GraphicsBuffer.InternalData does not exist in .net 2.0

good alternatives look like:

GetBuffer
or
DataBuffer

Compiler doesn't like what i'm typing down... Next SDK comes out in a couple weeks weeks with hopefully a little documentation.


Share this post


Link to post
Share on other sites

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