Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualnoatom

Posted 02 October 2012 - 01:35 PM

solved

#1noatom

Posted 02 October 2012 - 01:24 PM

A guy said that I should use this p=(cos(t)*r+h, sin(t)*r+k) where 0<=t<2*pi to draw a circle.

This is the code I used:

[source lang="cpp"]Vertex ball[6]; for(int i = 0; i<6;i++){ float x ; float y; ball[i].Pos = XMFLOAT3(cos((long double)i)*100+0, sin((long double)i)*100+0, 0.0f); ball[i].Color = (const float*)&Colors::White; } D3D11_BUFFER_DESC ballBuffer; ballBuffer.Usage = D3D11_USAGE_IMMUTABLE; ballBuffer.ByteWidth = sizeof(Vertex) * 6; ballBuffer.BindFlags = D3D11_BIND_VERTEX_BUFFER; ballBuffer.CPUAccessFlags = 0; ballBuffer.MiscFlags = 0; ballBuffer.StructureByteStride = 0; D3D11_SUBRESOURCE_DATA vinitDataBall; vinitDataBall.pSysMem = ball; HR(md3dDevice->CreateBuffer(&ballBuffer, &vinitDataBall, &mBallVB));md3dImmediateContext->IASetVertexBuffers(0, 1, &mBallVB, &stride, &offset); for(UINT p = 0; p < techDesc.Passes; ++p) { XMMATRIX w3 = XMMatrixIdentity(); XMMATRIX worldViewProj3 = w3*view*proj; mfxWorldViewProj->SetMatrix(reinterpret_cast<float*>(&worldViewProj3)); mTech->GetPassByIndex(p)->Apply(0, md3dImmediateContext); md3dImmediateContext->Draw(6,0); }[/source]


But the result is:

Posted Image


Why are there 2 triangles instead of a ball?

PARTNERS