Register a Template in DirectX

Started by
1 comment, last by dx_maniac_dx 12 years, 1 month ago
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
Advertisement
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));

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.



[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]I dont know what I have done wrong. Im still thinking about it. i hope you can give me a hint.[/font]




[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]best regards[/font]




[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]dx_maniac_dx[/font]



EDIT: Yeah, thats right.I thought that could be the problem so I've used [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

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

[/font]

I Want To Learn DirectX

This topic is closed to new replies.

Advertisement