none
如何设置Direct2D 的BlendState? RRS feed

  • 问题

  • 我在用图形调试的时候发现Direct2D渲染中BlendState始终为

    我尝试过在D3D11DeviceContext中设置BlendState,但并不管用

    我如何能自己设置BlendState?


    2022年3月16日 3:51

答案

全部回复

  • 您好,
    你可以参考这个相似线程的答案
    Direct3D11 中的所有资源都是不可变的,因此当您创建新的 Blendstate(mDevice, new BlendStateDescription()) 时,您以后无法更改描述。
    var blendDescription = new BlendDescription();
    blendDescription.RenderTarget[0].IsBlendEnabled = .. // 设置所有值
    [...]
    var blendState = new BlendState(device, blendDescription);
    context.OutputMerger.SetBlendState(blendState, ...);


    Best Regards,
    Minxin Yu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2022年3月16日 7:50
  • 我并不是想改变现有的BlendState,而是想设置新的BlendState. 但是Direct2D中没有D3D11里面的OMSetBlendState接口。
    2022年3月16日 8:59
  • 费了老大劲,终于搞定了。只能Hook CreateBlendState,虽然麻烦但还可行
    2022年3月17日 2:35