Microsoft C++ exception: long at memory

Started by
8 comments, last by jpetrie 15 years, 3 months ago
<Delete Me!> [Edited by - core8583 on December 29, 2008 9:31:35 AM]
Advertisement
How are you determining that you have a memory leak?
<Delete Me!>

[Edited by - core8583 on December 29, 2008 9:15:48 AM]
Clearly, you don't know what a memory leak is.

Regardless, turn on the Debug Runtimes, and check the return code of all your DX calls, especially those for creating an effect. They are likely failing.
Sirob Yes.» - status: Work-O-Rama.
<Delete Me>

[Edited by - core8583 on December 29, 2008 9:33:02 AM]
Quote:Original post by core8583
Have done i get the error.

(ERROR) :Vertex shader function usage (D3DDECLUSAGE_TANGENT, 0) does not have corresponding usage in the current vertex declaration.

Just to make sure i'm reading the error correctly it's saying that my Tangent are all coming as 0. Yes?
Nope. It means that your vertex declaration doesn't have any tangent in it, so the vertex shader doesn't know where it's supposed to get the tangent from.
<Delete Me>

[Edited by - core8583 on December 29, 2008 9:57:14 AM]
<Delete Me>

[Edited by - core8583 on December 29, 2008 9:04:28 AM]
Quote:Original post by core8583
I thought I did here,

struct CUSTOMVERTEX
{
D3DXVECTOR3 position; // vertex position
D3DXVECTOR3 normal; // surface normal at vertex
FLOAT tu, tv;
D3DXVECTOR3 tangent;
};


#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1|D3DDECLUSAGE_TANGENT)

Is this right?
D3DDECLUSAGE_TANGENT isn't a FVF code, that like makes as much sense to D3D as:
#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1|D3DDEVTYPE_HAL)
unfortunately [smile]

If you're using shaders, I'd highly recommend using vertex declarations instead of FVF codes, since you get much more control over what goes into your shader.

Quote:Original post by core8583
After changing D3DDECLUSAGE_TANGENT to D3DFVF_TEX2 and changing

float3 Tangent : TANGENT to float3 Tangent : TEXTCOORD1 it works.
I'm not even sure that's right actually, it might just happen to work in this case. At any rate, you're only specifying a 2D value instead of 3D. As far as I know, there's no way to specify tangents when using FVF codes. Again, vertex declarations are the way to go to fix this.

Quote:Original post by core8583
My next Question is how to i would out Tangents? Anyone got the Math forumla for them ?
Google has all the answers [smile]
In the future, please do not edit away the contents of your posts after the fact like this. It makes it extremely difficult for other users to benefit from the discussion the thread supported, which is detrimental to the community as a whole.

I'm closing this now.

This topic is closed to new replies.

Advertisement