Im trying to change the mesh of a vertex buffer using UpdateSubresource, the layout is the same, everything is the same, I just trying to change the vertices(from a ball to a cube, lets say).
Since everything is the same I though doing just a call to UpdateSubresource and then IASetVertexBuffers would be fine, but notting happens, the ball is still being rendered...So Im probaly missing some concepts..No warnings or errors are being displayed on the output..
Some code:
The buffer I create at first, this works fine:
D3D11_BUFFER_DESC buffdesc = {0};
buffdesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
buffdesc.ByteWidth = iSizeOfpV_p;//sizeof( vposnormaltex )*24;//
buffdesc.Usage = D3D11_USAGE_DEFAULT;
D3D11_SUBRESOURCE_DATA subres = {0};
subres.pSysMem = pV_p;//vertex array(ball)
if( pDevice_p->CreateBuffer( &buffdesc, &subres, &pVBuff_p ) != S_OK ) return E_FAIL;
So I create the Input Layout to the input assemble stage, this works fine also.
//Create Input Layout(based on the desc passed as param)
D3DX11_PASS_DESC passdesc = {0};
pEPass_p->GetDesc( &passdesc );
donne( pInputLayout_p );
if( pDevice_p->CreateInputLayout( InputElmDesc_p, NumElm,
passdesc.pIAInputSignature, passdesc.IAInputSignatureSize,
&pInputLayout_p ) != S_OK ){
for( UINT i=0; i<NumVB; i++ ) donne( pVBuff_p );
for( UINT i=0; i<NumIB; i++ ) donne( pIBuff_p );
return E_FAIL;
}
//bind buffers(vertex mesh) to the IA:
UINT offset = NULL;
pDIContext_p->IASetVertexBuffers( 0, NumVB, pVBuff_p, strides, &offset );
//set the input layout to the Input Assembly
pDIContext_p->IASetInputLayout( pInputLayout_p );
//set primitive type:
pDIContext_p->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
Now Im trying to just update the vertex buffer, so I can display other stuff, Im doing this:
//Update VBuffer with new data:
D3D11_BOX bla; ZeroMemory( &bla, sizeof(D3D11_BOX));
pDIContext_p->UpdateSubresource( pVBuff_p, 0, &bla, pV_p, 0, 0 );
//Bind VBuffer to the Input Assemble
UINT offset = NULL;
pDIContext_p->IASetVertexBuffers( 0, 1, &pVBuff_p, &strides[0], &offset );
pVBuff is the same vertex buffer used for the ball, its not Resource interface, is a Buffer interface..
Like I said, nothing happens..What Is going on?