Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Meshbuilder


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 12 August 1999 - 07:36 AM

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,



Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 11 August 1999 - 06:05 PM

Oohh.

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


-DeadLine


#3 Shinkage   Members   -  Reputation: 595

Like
Likes
Like

Posted 12 August 1999 - 07:36 AM

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.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS