Advertisement

Meshbuilder

Started by August 12, 1999 01:36 PM
1 comment, last by GameDev.net 25 years, 5 months ago
Oohh.

You're using RealMode...
ugh!
Good Luck


-DeadLine

Hello,

I'm having a little difficulty using the IDirect3DRMMeshbuilder's GetVertices function. When I use it, I check the HRESULT return value and apparently it tells me I've "Passed a Bad Value". Actually I'm using the the DirectX5 SDK (not 6, since 6s GetVertices function has severly been changed).

I'm not sure what's wrong. Here's the code:

DWORD *vcount;
D3DVECTOR *vertices;
DWORD *ncount;
D3DVECTOR *normals;
DWORD *faceDataSize;

MESHSTRUCT zmeshstruct;
HRESULT myresult;

myresult = mesh->GetVertices(cvcount, xcvertices, ncount, normals, faceDataSize, NULL);


Now, I know that faceDataSize can't be NULL. But if I pass NULL as the last parameter (which would be the faceData), the function returns the DataSize in the faceDataSize variable. Besides, ALL I'M TRYING TO DO IS GET VERTEX POSITIONS! I don't want normals or vertex counts or facedata, just positions (why does it hafta be so damn hard?).

If anyone could help me, it would be greatly appreciated.

Thanks alot,

Advertisement
Um, first off it appears that you are calling the GetVertices function from a Direct3DRMMesh interface, not MeshBuilder. Whatever the case, both of these functions have to be called in two steps--one to retrieve the vertex count and one to retrieve the vertices. Also, it's importatant to remember to allocate memory properly.

// Direct3DRMMeshBuilder
DWORD vertexcount;
D3DVECTOR *vertices;

MeshBuilder->GetVertices( 0, &vertexcount, NULL );
vertices = new D3DVECTOR[vertexcount];
MeshBuilder->GetVertices( 0, &vertexcount, vertices );

// Direct3DRMMesh
// This version is a little more complicated
// as you have to call it for every group in
// the mesh.

// D3DRMGROUPINDEX i - set to current group
DWORD vertexcount, datasize;
D3DRMVERTEX *vertices;

Mesh->GetGroup( i, &vertexcount, NULL, NULL, &datasize, NULL );
vertices = new D3DRMVERTEX[vertexcount];
Mesh->GetVertices( i, 0, vertexcount, vertices );

Personally, I would suggest coding your own geometry engine in Immediate Mode, as it is almost infinitely preferable to Retained Mode.

This topic is closed to new replies.

Advertisement