代码之家  ›  专栏  ›  技术社区  ›  Seb

使用C在Direct X中将纹理渲染为纹理#

  •  1
  • Seb  · 技术社区  · 14 年前

    我目前正在将一个avi流渲染为纹理,并使用Visual Studio 2005和2010年6月版的Direct X SDK在C_中将它们显示到面板中。我想把一些文字放在纹理上作为水印或标志放在左下角。我的问题是,我怎样才能将带有字体水印的纹理保存到另一个纹理上。我一直在研究渲染目标,但没有成功,除非我错过了一步。对此,任何帮助都将不胜感激。

    下面是关于如何渲染纹理和字体的当前代码。

    device.Clear(ClearFlags.Target, System.Drawing.Color.FromArgb(255, 255, 255).ToArgb(), 1.0f, 0);
    
            device.BeginScene();
            {
                device.VertexFormat = CustomVertex.TransformedTextured.Format;
                device.SetTexture(0, tex);
                device.DrawUserPrimitives(PrimitiveType.TriangleList, 2, verticies);
    
                text.DrawText(null, "Test", new Point(10, 20), Color.White);
            }
            device.EndScene();
    
            device.Present();
    
    1 回复  |  直到 14 年前
        1
  •  1
  •   Goz    14 年前

    查找setrenderTarget,然后将要渲染的纹理设置为渲染目标并进行渲染(请记住适当设置顶点上的UV!).