• Advertisement
Sign in to follow this  

Modify vertex buffer

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

I called lock method, modified the VERTEX buffer changing the x and y components, then called unlock on the buffer. But it didnt seem to work, it disappeared. Anyhow know of any further processing after re-tranforming a vertex structure? Any links of a tutorial modifying the buffer? Thanks, Nick

Share this post


Link to post
Share on other sites
Advertisement
RestoreDevices

VERTEX VerticesButtonGrey[] =
{
{ 50.0f, 50.0f, 0.5f, 1.0f, 0.0f, 0.0f, }, // x, y, z, rhw, tu, tv
{ 150.0f, 50.0f, 0.5f, 1.0f, 1.0f, 0.0f, },
{ 150.0f, 100.0f, 0.5f, 1.0f, 1.0f,1.0f, },
{ 50.0f, 100.0f, 0.5f, 1.0f, 0.0f,1.0f, },
};
m_dwSizeofVertices = sizeof(Vertices);
m_dwSizeOfVerticesWindow = sizeof(VerticesWindow);
m_dwSizeOfVerticesButtonGrey = sizeof(VerticesButtonGrey);

...

// Grey Button 150x80
if( FAILED( m_pd3dDevice->CreateVertexBuffer( m_dwSizeOfVerticesButtonGrey,
D3DUSAGE_DYNAMIC, FVF,
D3DPOOL_DEFAULT, &m_pVBButtonGrey, NULL ) ) )
return E_FAIL;
VERTEX* pVerticesButtonGrey;
if( FAILED( m_pVBButtonGrey->Lock( 0, m_dwSizeOfVerticesButtonGrey, (VOID**)&pVerticesButtonGrey, 0 ) ) )
return E_FAIL;
memcpy( pVerticesButtonGrey, VerticesButtonGrey, m_dwSizeOfVerticesButtonGrey);
m_pVBButtonGrey->Unlock();


Render

// translate the vertices to show the button correctly
VERTEX* pVerticesButtonGrey;
if( FAILED( m_pVBButtonGrey->Lock( 0, m_dwSizeOfVerticesButtonGrey, (VOID**)&pVerticesButtonGrey, 0 ) ) )
return E_FAIL;
//memcpy( pVerticesButtonGrey, VerticesButtonGrey, m_dwSizeOfVerticesButtonGrey);
for( int i=0; i<4; i++)
{
pVerticesButtonGrey.x += 50;
//pVerticesButtonGrey.y += 50;
}
m_pVBButtonGrey->Unlock();

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement