Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Register a Template in DirectX


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 dx_maniac_dx   Members   -  Reputation: 100

Like
0Likes
Like

Posted 04 March 2012 - 12:04 PM

Hello everybody,

i have problems to register a template in directx. I've tried two things to solve this problem but it's impossible.

I have set the LPD3DXFILE interface:

LPD3DXFILE xFile;

create it with the D3DXFileCreate( ID3DXFile** lplpDirectXFile ) function:

D3DXFileCreate(&xFile);

i check the return value and it returns S_OK... thats a good message but now my problem.....

i want use the xFile interface to set the templates i want to use with the RegisterTemplates function like this:

xFile->RegisterTemplates(XSKINEXP_TEMPLATES, strlen(XSKINEXP_TEMPLATES));

return value:

D3DXFERR_PARSEERROR

then ive tried this:

xFile->RegisterTemplates((LPVOID)XSKINEXP_TEMPLATES, sizeof( XSKINEXP_TEMPLATES ) - 1 );

again the same return value:

D3DXFERR_PARSEERROR

I'm just watching my listing and think about what i have done wrong at the moment and cant go further...

I hope you can help me.....

best regards

dx_maniac_dx
I Want To Learn DirectX

Sponsor:

#2 froop   Members   -  Reputation: 639

Like
0Likes
Like

Posted 04 March 2012 - 01:06 PM

What is XSKINEXP_TEMPLATES? A char array? Your second call doesn't make sense because the function wants to know the buffer size, and not the buffer size - 1. (Edit: I guess the -1 is to subtract the string terminating symbol?)

Does the example from the docs work for you? http://msdn.microsof...v=vs.85%29.aspx

   TIDirectXFile * pDXFile;
	char *szTemplates = "xof 0303txt 0032\
		template SimpleData { \
			<2b934580-9e9a-11cf-ab39-0020af71e433> \
			DWORD item1;DWORD item2;DWORD item3;} \
		template ArrayData { \
			<2b934581-9e9a-11cf-ab39-0020af71e433> \
			DWORD cItems; array DWORD aItem[2][cItems]; [...] } \
		template RestrictedData { \
			<2b934582-9e9a-11cf-ab39-0020af71e433> \
			DWORD item; [SimpleData]}";
	hr = pDXFile->RegisterTemplates(szTemplates, strlen(szTemplates));


#3 dx_maniac_dx   Members   -  Reputation: 100

Like
0Likes
Like

Posted 04 March 2012 - 01:57 PM

Hi froop.

Yeah, this example from the docs works but for some reason the template definition

XSKINEXP_TEMPLATES from the d3dx9mesh.h doesn't work.


I dont know what I have done wrong. Im still thinking about it. i hope you can give me a hint.



best regards



dx_maniac_dx


EDIT: Yeah, thats right.I thought that could be the problem so I've used

-1 to subtract the string terminating symbol but that wasn't the problem.


Edited by dx_maniac_dx, 04 March 2012 - 02:08 PM.

I Want To Learn DirectX




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