【问题标题】:Tracking Direct2D rendering跟踪 Direct2D 渲染
【发布时间】:2014-04-11 14:28:41
【问题描述】:

默认情况下,Direct2D 图片在 EndDraw 函数后显示在屏幕上。

出于调试目的,我需要在绘制任何绘制图元后将图片显示在屏幕上。

这在 Direct2D 中可行吗? 在 GDI 中,我使用了 GdiSetBatchLimit(1)

【问题讨论】:

标签: directx win32gui direct2d


【解决方案1】:

这是不可能的。您需要围绕每个图元进行 BeginDraw/EndDraw。如果您有图层或剪辑,您还需要在每个图元周围设置和删除它们。

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

【讨论】:

    【解决方案2】:

    您可以在 D2D 目标上呈现 GDI 内容 (Direct2D and GDI Interoperability Overview)

    或者,您可以尝试使用一个循环,将一个基元(然后是两个,然后是三个直到您的绘图代码结束)封装在 Begin/End's 中。就像下面的伪代码:

    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.
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-07-22
      • 2016-02-11
      • 2012-12-11
      • 2016-06-16
      • 2019-06-26
      • 2010-10-21
      相关资源
      最近更新 更多