Advertisement Jump to content
Sign in to follow this  

Problems saving a progressive mesh (data corruption?)

This topic is 4908 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm trying to store an optimized (progressive) mesh, using DirectX8. The 'normal' mesh which I use to generate the progressive mesh is 100% valid, saves perfect, and opens perfect in the meshviewer. (and also works great when I make a progressive mesh of it in the viewer) The progressive mesh is generated, and saved correctly. Except the start of the file is completely different. Can someone help me on this? It's hopefully one of the last D3DX mesh function woes which I have to go through. Method 1:
if (FAILED(D3DXGeneratePMesh(myMesh,(DWORD*)m_pAdjacency->GetBufferPointer(),
NULL ,NULL,1000,D3DXMESHSIMP_FACE, &mySPMesh))) OutputDebugString(_T("23. Error"));

// Local declaration 
	IStream* pStream = NULL;
	IStorage* pStorage;
	CComBSTR bsFileName("progressive.x");
	HRESULT hResult;

	STGFMT_STORAGE, 0, NULL, NULL, IID_IStorage, (void**)(&pStorage));

	//// Create stream in the storage
	hResult = pStorage->CreateStream(L"MyStream", STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &pStream);

	// Save PMesh to stream
	hResult = mySPMesh->Save(pStream, NULL, NULL);
Method 2:
WCHAR* filename = _T("file.x"); 
WCHAR streamName[] = L"streamOut"; 


hr = StgCreateDocfile(filename, STGM_CREATE|STGM_WRITE | 
            STGM_SHARE_EXCLUSIVE, 0, &pStorage); 

pStorage->CreateStream(streamName, STGM_CREATE|STGM_WRITE| 
            STGM_SHARE_EXCLUSIVE, 0, 0, &pStream);

	//// Save PMesh to stream
	hResult = mySPMesh->Save(pStream, NULL, NULL);
Start of mesh saved in MeshViewer (progressive mesh):
xof 0303bin 0032
My saved mesh:
ÐÏࡱá (can't paste because of strange blocky things :P)
I am clueless what might be causing this. The progressive mesh is created completely OK.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!