Skip to main content
GameDev.net gamedev.net
🔒 Locked

Meshes

Started by Zmax Sep 25, 2005 at 7:55 AM 1 replies 500+ views
Original Post
Zmax
Zmax
I wanted to create a mesh from the code...and to put my vertexBuffer,IndexBuffer inside in order to create the normals for the each vertex in my buffer.(using the computeNormals of the mesh) I don't know what's wrong here but i get an overflow error,..


        Dim auxMesh As Mesh = Nothing
        auxMesh = New Mesh(HeightMapCls.BmpWidth * HeightMapCls.BmpHeight / 3, HeightMapCls.BmpWidth * HeightMapCls.BmpHeight, MeshFlags.SystemMemory, MyVertexType.Format, device)

        auxMesh.VertexBuffer.SetData(HeightMapCls.verts, 0, 0)
        auxMesh.IndexBuffer.SetData(HeightMapCls.indexArray, 0, 0)

        auxMesh.ComputeNormals()

        VertexCls.vertexBuffer = auxMesh.VertexBuffer
        VertexCls.indexBuffer = auxMesh.IndexBuffer


        device.SetStreamSource(0, VertexCls.vertexBuffer, 0)
        device.Indices = VertexCls.indexBuffer

The...number of faces parameter should be: vertexNR/3 no?,..hmmm what could be?
neneboricua19
neneboricua19
You should probably take a look at the MeshFromOBJ sample that comes with the SDK. That sample shows how to initialize an ID3DXMesh object with data gathered from any source. The mesh specifically gathers the data from a Wavefront Object file (.obj) but all you need to look at is how they create and initialize the mesh once they have the data available.

neneboricua
Zmax
Zmax
What skd? i don't have that sample in my dx9 sdk...hmm can you pls give me a link or something?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.