Sign in to follow this  
smally

Struggling with dynamic geometry

Recommended Posts

Ok, quick question, I'm struggling learning to do dynamic geometry in D3D9, and the Direct3d book I'm learning from, only talks about it for for one page, with no code. Is there anywhere online that can help me with using dynamic geometry? (google has failed me) I'm just trying to do a simple ocean waves scene, but everytime is use D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC and D3DLOCK_DISCARD my program crashes. Thanks in advance.

Share this post


Link to post
Share on other sites
Quote:
Original post by smally
I'm just trying to do a simple ocean waves scene, but everytime is use D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC and D3DLOCK_DISCARD my program crashes.
That means you're not responding to D3D errors correctly. Every D3D function that returns information you rely on MUST have its return value checked. For instance, CreateVertexBuffer() returns a pointer. If you ignore the return value from it and assume it succeeded, then when it fails you have a broken pointer. Which you then dereference and the whole program blows up.

You should also always be using the Debug Runtimes.

As for the actual problem, we'll need to see some code, and what you mean by "crash" (I.e. the exact runtime error you get [Like "Access Violation reading 0x0000004"]), and the line of code causing it.

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