///////////////////*****************//////////////
m_pTerrainObject->SetFVF( m_pd3dDevice, D3DFVF_VERTEX );
{
LPDIRECT3DVERTEXBUFFER8 pVB;
VERTEX* pVertices;
DWORD dwNumVertices = m_pTerrainObject->GetSysMemMesh()->GetNumVertices();
m_pTerrainObject->GetSysMemMesh()->GetVertexBuffer( &pVB );
pVB->Lock(0, 0, (BYTE**)&pVertices, 0);
for ( DWORD i=0; i < dwNumVertices; i++ )
{
pVertices[i].p.y += 1*(rand()/(FLOAT)RAND_MAX);
pVertices[i].p.y += 2*(rand()/(FLOAT)RAND_MAX);
pVertices[i].p.y += 1*(rand()/(FLOAT)RAND_MAX);
}
pVB->Unlock();
pVB->Release();
}
After the vertex buffer is retrieved, and the vertices are operated on, the vertex buffer is released???????
How can this work, if the vertex buffer is released the vertices should no longer exist and therefore when it comes to rendering, there should be nothing to render........
Obviously it does work, but I can't understand why?
(All I can think of is that the COM ref count is incremented when GetVertexBuffer is called?)
Can anyone help me with this.
[/source]
Releasing a vertex buffer
I've been going through the DirectX 8.1 sdk and I have a problem with the section on Shadow volumes. During the initialization stage the terrain is operated on to give it a bit or random displacement in the y axis.
the pVertices is an array that is fillesd with the vertecies data and used after that in rendering .
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement