Jump to content
  • Advertisement
Sign in to follow this  
roczhao

about D3DX RegisterTemplate's parsererror?

This topic is 4817 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

Ok, so I get parser errors while using D3DXLoadMeshFromX(), and I'm told that the parser has been rewritten in dx9 to be more strict, that I should parse my .x files manually. So, I have a simple cube exported from Blender. D3DXLoadMeshFromX loads the mesh! However, if I try to use the ID3DXFile interfaces, it all comes tumbling down.. Here is my results with particular functions so far: D3DXFileCreate(): S_OK. Works. No problems here. ID3DXFile::RegisterTemplates(): D3DXFERR_PARSEERROR. This doesn't work period. Copying from the example in the SDK doesn't work either. My file doesn't contain the template headers, so do I even need to use this? What am I doing wrong? See code further down. CreateEnumObjects(): S_OK. This actually works! So I at least have something right... I think... ID3DXFileEnumObject::GetChildren(): S_OK. Works, except it always returns 0. ID3DXFileEnumObject::GetChild(0, e): D3DXFERR_NOMOREOBJECTS. Well, I expected that after getting 0 with the last call. Here is my code.. it's not spectacular, nor is it really any different from all the examples I've seen, except that it doesn't work.
//
bool ParseX::Paser(char *Xfilename,void **pData)
{
	LPD3DXFILE lpd3dxfile;
	LPD3DXFILEENUMOBJECT lpd3dxfilenumobj;
	LPD3DXFILEDATA lpd3dxfiledata;
	
	//
	if (NULL==Xfilename)
		return false;

	//
	HRESULT hr=D3DXFileCreate(&lpd3dxfile);
	if FAILED(hr)
	return false;

	//
	hr=lpd3dxfile->RegisterTemplates( (LPVOID)XSKINEXP_TEMPLATES, sizeof( XSKINEXP_TEMPLATES ) - 1);//strlen(XSKINEXP_TEMPLATES));
	if FAILED(hr)
	{
		lpd3dxfile->Release();

		DXTRACE_ERR("RegisterTemplates:=",hr);
				return false;
	}
[Edited by - Coder on September 9, 2005 2:53:40 AM]

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!