Jump to content
  • Advertisement
Sign in to follow this  
core8583

Microsoft C++ exception: long at memory

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

Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3489 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.

Guest
This topic is now closed to further replies.
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!