Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Trouble creating Vertex Buffer

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

Whenever i try to create a vertex buffer I get an access violation. Here''s my function:
	{m_pd3dDevice->CreateVertexBuffer(m_numOfVerts * sizeof (CUSTOMVERTEX), D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, 

        	return S_OK;
and its called by;
HRESULT CMyD3DApplication::InitDeviceObjects()
    // TODO: create device objects


    return S_OK;

Any suggestions?

Share this post

Link to post
Share on other sites
Use the DEBUG Direct3D runtime and ramp up the debug ouput level to see if D3D is unhappy about anything.

There isn''t much that could go wrong with the particular call you posted though. When you say that the device pointer is valid, do you mean you actually checked its value in the debugger after the crash happened or does it mean "it _should_ be valid because I set it up and passed it in from xyz, but haven''t actually checked at runtime" ?

Most faults with CreateVertexBuffer should return an error rather than giving an access violation (the debug runtime is essential during development). There are only really 4 things which could be bad:

1) any of the pointers are NULL or point to bad memory.
2) the size has become screwed up.
3) the device has been created for software vertex processing, but the usage doesn''t match that.
4) the vertex format is screwed.

[attempt #2, HTTP500]

Simon O''Connor
Creative Asylum Ltd

Share this post

Link to post
Share on other sites

  • 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!