Is there anyway to convert Vertex/Index buffer into a mesh and save it as .x?

Started by
2 comments, last by JoeyBlow2 18 years, 7 months ago
I'm trying to take a vertex/index buffer and save it as a .x file. Is there any easy way to do that? I am not using FVF and am using Vertex Declarations that are explained in the DX9 SDK. When I looked at the docs I seen no way to do it easily but I might have missed something. Or if someone has done it before, maybe they don't mind sharing? Thanks for any help. I'd rather not calculate the 67000 polygons from scratch every time. I'd rather just save it without calculating the normals, etc every time.
Advertisement
Hi, yes just create a ID3DXMesh (using D3DXCreateMesh or D3DXCreateMeshFVF) and fill it with your data (lock and write) and then call D3DXSaveMeshToX.

------------------------See my games programming site at: www.toymaker.info
Hi there JoeyBlow2, How are you doing buddy?

The Problem
Saving mesh/vertex buffer information to a .x file.
The Solution
Once again DirectX comes to the rescue with a interface called ID3DXFile.

So what you need to do is read on how to create the ID3DXFile::CreateSaveObject() which will help you to save information to a .x file :)

I hope this helps buddy.
Take care and if you have any more questions do not hestitate to ask.
Thanks guys. I'll take a look at those approaches and see what I can do.

This topic is closed to new replies.

Advertisement