This is how i initialized the D3D11_BUFFER_DESC for my indices. When i go to bound it to the deviceContext i get this error.
D3D11 ERROR: ID3D11DeviceContext::IASetIndexBuffer: The Buffer trying to be bound as an IndexBuffer did not have the appropriate bind flag set at creation time to allow the Buffer to be bound as an IndexBuffer. [ STATE_SETTING ERROR #241: IASETINDEXBUFFER_INVALIDBUFFER]
And is kinda of strange becouse i setted the bindFlags to "D3D11_BIND_INDEX_BUFFER"
D3D11_BUFFER_DESC buffDescIndices;
ZeroMemory(&buffDescIndices, sizeof(D3D11_BUFFER_DESC));
buffDescIndices.MiscFlags = 0;
bufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
buffDescIndices.Usage = D3D11_USAGE_DEFAULT;
buffDescIndices.ByteWidth = sizeof(UINT) * ARRAYSIZE(indices);
buffDescIndices.StructureByteStride = 0;
buffDescIndices.CPUAccessFlags = 0;
D3D11_SUBRESOURCE_DATA subResData2;
subResData2.pSysMem = indices;
HRESULT hr=device->CreateBuffer(&buffDescIndices, &subResData2, &mBoxIB);
And this is the deviceContext call
deviceContext->IASetIndexBuffer(mBoxIB, DXGI_FORMAT_R32_UINT, 0);