Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 

 Home / 3D Theory & Graphics / D3DXComputeTangent() fails under new April SDK Account Manager
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
theAntiELVIS

March 31, 2005, 06:42 AM

This line:

  1.  
  2.  
  3. hr = D3DXComputeTangent( pMeshSysMem2, 0, 0, 0, TRUE, NULL );
  4.  
  5.  


worked fine from DirectX 8.0 up through the December 2004 DirectX 9 SDK. Now, under the new April SDK, it fails and my tangent data isn't generated.

Anyone else encountered this? I know MS has moved D3DX into a new lib (d3dx9d.lib instead of d3dx9dt.lib). Also, for some reason, I can not get the definition of the returned hr value in debug mode anymore - just the integer value, so I'm not sure if it's returning a valid error value (invalid call, invalid data, or memory allocation). The debugger does report the hr value as S_OK BEFORE the call (which I explicitly set it to), but on return from the call it's a massively huge negative number.

This all sucks, to say the least, because when the call fails my nice bump-mapped planets fail to render....

 
Wernaeh

March 31, 2005, 06:05 PM

Hi there...
Quoting from the MSDN:

HRESULT D3DXComputeTangent(
LPD3DXMESH InMesh, pMeshSysMem2
DWORD TexStage, 0
LPD3DXMESH OutMesh, ?? Maybe you are missing some parameter here ??
... and an old macro was there which did f.e.
copy the InMesh (just guessing on that) ...
DWORD TexStageUVec, 0
DWORD TexStageVVec, 0
DWORD Wrap, TRUE
DWORD* pAdjacency NULL
);

Also do the usual stuff (i.e. check if pMeshSysMem2 is valid etc).
About the HR, you might try looking up the generated value within the d3d9.h errors section...

Sorry if I couldn't be of more help,

Cheers,
- Wernaeh

 
theAntiELVIS

March 31, 2005, 07:06 PM

The current DX docs gives:

HRESULT WINAPI D3DXComputeTangent(
LPD3DXMESH Mesh,
DWORD TexStageIndex,
DWORD TangentIndex,
DWORD BinormIndex,
DWORD Wrap,
const DWORD *pAdjacency
);

I tried putting in the OutMesh param, but the compiler complains with "function does not take 7 parameters"

The mesh pointer is valid, etc. I have ascertained that the hr return value is the error value for "invalid call". But how can that be?

But thanks....

 
theAntiELVIS

April 01, 2005, 07:29 PM

Putting D3DX_DEFAULT into the BinormalIndex parameter solved the problem. My vertex declaration has no binormal data. Apparently D3DX used to let this slide, but it is now being enforced. Either that, or the value of D3DX_DEFAULT used to be 0 and has been changed. Either way, it's working again.

Now if I could just figure-out why I can no longer set the mipfilter sampler state to anisotropic....that causes an exception now that crashes the program.

Oh, well.

 
This thread contains 4 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.