Sign in to follow this  

CreateVertexBuffer problem

Recommended Posts

boroboy00x    122
I am getting an exception error from this statement
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
Evil Steve    2017
Original post by Namethatnobodyelsetook
The only part of that which should throw an exception is if gD3dDevice isn't setup yet.

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
Supernat02    604
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,

Share this post

Link to post
Share on other sites

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