1
votes

By default, Direct2D picture is displayed on the screen after the function EndDraw.

For debugging purposes, I need the picture to be displayed on the screen after drawing of any draw primitive.

Is this possible in Direct2D? In GDI for these purposes I used GdiSetBatchLimit(1)

2
Although it won't display on screen, you may be able to isolate an error by periodically calling ID2D1RenderTarget::Flush. - Roger Rowland

2 Answers

0
votes

It's not possible. You'll need to BeginDraw/EndDraw around every primitive. If you have layers or clips you'll need to set and remove them around every primitive too.

Drawing operations can only be issued between a BeginDraw and EndDraw call.

0
votes

You can render GDI content on a D2D target (Direct2D and GDI Interoperability Overview)

Or else you can try with a loop that will encapsulate one primitive (then two, then three until the end of your drawing code) inside Begin/End's. Just like the pseudo code below:

for (i=0; i<number of primitives; i++)
{
    Begindraw;
    Drawprimitive0;
    if (i == 0)
    {
        EndDraw();
        continue;
    }

    Drawprimitive1;
    if (i == 1)
    {
        EndDraw();
        continue;
    }

    Drawprimitive2;
    if (i == 2)
    {
        EndDraw();
        continue;
    }

    etc.
}