How to create a mesh, not loading it from an x-file?
How to create it from a vertex array?
Thank you...
Posted on 2002-11-26 07:54:31 by Vaxon
Check out the D3D api interfaces at msdn.microsoft.com ... also the D3DX "helper api".
Posted on 2002-11-27 02:03:36 by Homer
Afternoon, Vaxon.

Are you talking about D3DXCreateMesh/D3DXCreateMeshFVF?

Cheers,
Scronty
Posted on 2002-11-27 05:48:47 by Scronty
Afternoon, Scronty.
Saw your site scrontsoft.com - very nice.
All tutes and samples work fine on my pc, except for the dolphin.
I didn't recomple it, just used the exe from the zip.
Well, back to the topic.
Yes, I was talking about those functions. D3DXCreateMeshFVF takes only numbers of faces and virtices as parameters and no pointers to vertex and index buffers. After I create a mesh, I have to fill it with vertices and indices, if I get it right. How to do that?
Thanks in advance.
Posted on 2002-11-27 06:13:23 by Vaxon
Afternoon, Vaxon.

Use the meshes' LockVertexBuffer method to get a pointer to its vertex buffer, and fill it anyway you wish.
Ditto for the LockIndexBuffer.
You've got to make sure you don't fill past the end of the buffers though (seems obvious, but very easy to do ;) ).

i.e. a few of those examples you mentioned, create a vertex buffer and render it as a vertex stream. You could easily modify the code so that the data is chucked into a mesh, and use the mesh methods to render the object.

What is it you're looking at using this for? Are you making a file parser for a non-xfile format file?

As for that dolphin example: It was assembled using libs from .NET. You may have more luck reassembling it (as long as you can find all of the required files located in the two "include" pages on my site ;) ). It was also using the DX8.1 include files. You've got DX8.1 installed I take it?

Cheers,
Scronty
Posted on 2002-11-27 06:26:15 by Scronty
Thank you, Scronty, for the fast and helpful reply.
I have dx8.1 SDK installed and dx8.1 retail runtime installed. I also have all the includes and libs for masm downloaded from your site. I'll try to recompile the example, hope it will work then.
As for the mesh creation...well, I'm not sure yet what I'm gonna use it for. I might use different file format or create meshes and save them to x-files. X-files have text format. So, it's easier to understand, but takes more place on disk. May be i'll use my own binary format. I'm new to this stuff. Just want to learn more at this point and then see where to use this knowledge. I use the help files coming with the sdk, but they are not very easy-to-read for a newbie and some stuff leaves questions unanswered. Thanks alot for helping.:alright:
Posted on 2002-11-27 07:21:09 by Vaxon
Afternoon, Vaxon.

heh. One thing you've got to remember is that the help files are really only a reference. It helps if you already know how to use the various objects and methods (makes it a little difficult to learn this stuff though ;) ).

With regards to the X file format: You can save it as text (the default), binary, or compressed (have a look at D3DXSaveMeshToX).

It's currently 12:46am here, so (when I wake up) I think I'll grab one of those example proggys and modify it so that it renders a mesh like I've described. It seems an example on doing so would be beneficial to both of us :).

Cheers,
Scronty
Posted on 2002-11-27 07:47:22 by Scronty
Thanks again, Scronty.
That will be really great.
Didn't know about the compressed x-file format, thank you.
Well, it's 5pm here and in a couple of hours i'll get home from work:)
and try to code something with d3d.
See you later.
It's begining to look more like chat than a message board.:)
Posted on 2002-11-27 07:54:45 by Vaxon
Afternoon, Vaxon.

It's begining to look more like chat than a message board.

So it seems :).

Cheers,
Scronty
Posted on 2002-11-27 08:01:34 by Scronty
Afternoon, Vaxon.

Attached is a basic example showing the usage of D3DXCreateMeshFVF to display two faces.

The proggy is based upon the Matrice.asm example.

have a look at the InitGeometry proc to see how the mesh is created, and the Render proc to see how it's rendered.

Cheers,
Scronty
Posted on 2002-11-27 20:40:03 by Scronty
Afternoon, Scronty.
Thank you very much. :alright:
Gonna take a look now.
Thanks again.
See you.
Posted on 2002-11-28 01:56:57 by Vaxon
Got it! thanks again, Scronty.:alright:
Posted on 2002-11-28 02:24:14 by Vaxon