Jump to content

  • Log In with Google      Sign In   
  • Create Account


Naruto-kun

Member Since 15 Oct 2012
Offline Last Active Jul 13 2014 11:09 AM
-----

Posts I've Made

In Topic: Drawing terrain starting from the top left

07 July 2014 - 12:03 AM

found the cause of the problem. Got assbitten by an extra 32 bytes at the end of the row during the image transfer from GPU to system mem. Everything working now.


In Topic: Drawing terrain starting from the top left

23 June 2014 - 03:45 AM

Good point ill try that.


In Topic: Drawing terrain starting from the top left

19 June 2014 - 06:41 AM

Any ideas?


In Topic: Drawing terrain starting from the top left

18 June 2014 - 12:10 PM

3 (mostly unrelated) things concerning your code but essential when using C++:

 

- you create your temporary vertex and index arrays using new[] so they must be deleted with delete[]. 

- the loop creating indices goes out of bounds, when z=79 and x=79 : 79 * 80 + 79 + 81 > 6399. In this case the maximum loop count should be 79. 

 

bd.ByteWidth = sizeof(ind)*38400; I don't know your target system but this line creates different output on x64 and x86, since the pointer size on each platform is different. You should use sizeof(unsigned long) instead.

 

Cheers!

 

Thanks. Any other ideas regarding the vertex order/positioning?


In Topic: Drawing terrain starting from the top left

17 June 2014 - 10:57 PM

The SetVertex and Index buffers part:

CreateBuffers(mvg->dev, &mvg->pVB, &mvg->pIB);
UINT stride = sizeof(VERTS);
UINT offset = 0;
mvg->devcon->IASetVertexBuffers(0, 1, &mvg->pVB, &stride, &offset);
mvg->devcon->IASetIndexBuffer(mvg->pIB, DXGI_FORMAT_R32_UINT, 0);

The input layout:

pFXT = pFX->GetTechniqueByName("RENDER");
if(pFXT)
{
	pFXT->GetDesc(&techDesc);

	D3D11_INPUT_ELEMENT_DESC ied[] = 
	{
		{ "ANCHOR", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
	};
	D3DX11_PASS_DESC PassDesc;
	pFXT->GetPassByIndex(0)->GetDesc( &PassDesc );
	dev->CreateInputLayout( ied, 1,	PassDesc.pIAInputSignature,	PassDesc.IAInputSignatureSize, &pLayout);
}

the draw call:

mvg->devcon->ClearRenderTargetView( mvg->rtv, D3DXCOLOR(0.0f,0.0f,0.0f,1) );
mvg->devcon->ClearDepthStencilView( mvg->dsv, D3D11_CLEAR_DEPTH, 1.0f, 0 );

mvg->devcon->IASetInputLayout( mvg->pLayout );
mvg->devcon->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

mvg->view->SetMatrix(&vMat.m[0][0]);
mvg->prj->SetMatrix(&pMat.m[0][0]);

for( UINT p = 0; p < mvg->techDesc.Passes; p++ )
{
	//apply technique
	mvg->pFXT->GetPassByIndex( p )->Apply(0, mvg->devcon);	

	//draw billboard
	mvg->devcon->DrawIndexed(38400, 0, 0);
}

PARTNERS