Advertisement

Modifying Frank Luna's Box demo for DirectX12 to print a 2D chart

Started by April 28, 2020 10:14 PM
0 comments, last by cppstudent 4 years, 9 months ago

I am studying Frank Luna's book and, as 'self-imposed' exercise I am trying to modify his Box demo code to draw a 2D chart, whatever, for example a line connecting few points. I replaced this line:

207    mCommandList->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

with this:

207    mCommandList->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP);

and I also replaced this line:

456    psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;

with this one:

456    psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;

I also built an indices file:

std::array<std::uint16_t, 14> indices =
    {
        0, 1, 

        1, 2,

        2, 3,

        3, 4,

        4, 5,

        5, 6,

        6, 7
        
    };

The compiler does not give errors, the window open but remains blank and after few seconds closes. Any hint ?

A second question: do linestrips need an indeces buffer ?

This topic is closed to new replies.

Advertisement