• Advertisement

Archived

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

Trouble creating Vertex Buffer

This topic is 5559 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:
  
HRESULT CQuake3BSP::CreateVBBSP(LPDIRECT3DVERTEXBUFFER8 *pVB)
(		
	{m_pd3dDevice->CreateVertexBuffer(m_numOfVerts * sizeof (CUSTOMVERTEX), D3DUSAGE_WRITEONLY, D3DFVF_CUSTOMVERTEX, 
		D3DPOOL_MANAGED, pVB);

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


    CQuake3BSP::CreateVBBSP(&m_pVB);

    return S_OK;
}

  
Any suggestions?

Share this post


Link to post
Share on other sites
Advertisement
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
www.creative-asylum.com

Share this post


Link to post
Share on other sites

  • Advertisement