Skip to main content
gamedev.net
🔒 Locked

Trouble creating Vertex Buffer

Started by rocknroll60s Dec 7, 2002 at 12:19 AM 2 replies 200+ views
Original Post
rocknroll60s
rocknroll60s
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?
niyaw
niyaw
is device pointer valid?
S1CA
S1CA
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
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.