Sign in to follow this  

CreateVertexBuffer problem

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

I am getting an exception error from this statement
gD3dDevice->CreateVertexBuffer( 12*sizeof(CUSTOMVERTEX),D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, D3DPOOL_MANAGED,&m_vb, NULL);
the problem is that m_vb which is defined as a LPDIRECT3DVERTEXBUFFER9 is not getting set and I do not understand why. This is the first time I have encountered this problem because I have used gD3dDevice->CreateVertexBuffer in previous projects. any suggestions as to why this occuring would help. Thanks in advance

Share this post


Link to post
Share on other sites
Quote:
Original post by Namethatnobodyelsetook
The only part of that which should throw an exception is if gD3dDevice isn't setup yet.
Seconded.

What exception do you get? Access violation I assume. Check the variable watch window for things like NULL pointers when you get the exception.
If its not an exception, and you mean that the function returns failure - do you have the debug runtimes installed with the debug output set to maximum? The debug runtimes will ALWAYS give you debug output if a function fails, and it'll probably tell you that one of the parameters is incorrect and why.

Share this post


Link to post
Share on other sites
You stated two mutually exclusive errors. Throwing an exception will halt the code and prevent it from continuing. For you to know that m_vb was remaining NULL, that code would have had to run properly. Which one did you mean? Did you mean that the function call failed because m_vb was not being set? Or did you mean that an excetion was thrown on this line and the code didn't go further?

If it was the later, it's because gD3dDevice is NULL, like the others said. If it was m_vb set to NULL, the only thing I can think of is that it doesn't like D3DPOOL_MANAGED for some reason. Try D3DPOOL_DEFAULT and see if it clears, then research it further if so.

Good luck,
Chris

Share this post


Link to post
Share on other sites

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this