Jump to content
  • Advertisement
Sign in to follow this  

D3DX.GetVectors Function

This topic is 2788 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'm trying to extract position and normal vectors from a standard cube mesh. I can extract the position vectors okay, as they form the first 3 floats in the sequence, but im having trouble trying to retrieve the normal vectors. Can anyone tell me how to do this?

I would appreciate a VB.Net example if possible. Cheers.

Here's some example code:

Private Sub ExtractVectors()

'local variables
Dim cube As Mesh = Mesh.CreateBox(gf.Graphics.Device, 100, 100, 100)
Dim stream As DataStream = Nothing
Dim positions() As Vector3 = Nothing
Dim normals() As Vector3 = Nothing

stream = cube.VertexBuffer.Lock(0, 0, LockFlags.None)

'retrieve position vectors
positions = SlimDX.Direct3D9.D3DX.GetVectors(stream, cube.VertexCount, cube.BytesPerVertex)

'retrieve normal vectors

'close datastream

'dispose unmanaged resources
End Sub

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!