为什么需要3D设备来创建DirectX中的2D设备上下文?

huangapple go评论59阅读模式
英文:

Why do I need a 3D device to create a 2D device context in DirectX?

问题

I am reading this page of the DirectX programming guide (https://learn.microsoft.com/en-us/windows/win32/direct2d/devices-and-device-contexts) and I wonder if anyone could help me understand the reason behind the following paragraph:

> What is a Direct2D device?
You need a Direct2D device and a Direct3D device to create a Direct2D device context. A Direct2D device (exposes an ID2D1Device interface pointer) represents a display adapter. A Direct3D device (exposes an ID3D11Device interface pointer) is associated with a Direct2D device. Each app must have one Direct2D device, but can have more than one device.

Why do I need a 3D device for creating a 2D device context instead of just creating a 2D device? What is happening behind the scenes and what is the role of the 3D device for rendering 2D graphics?

英文:

I am reading this page of the DirectX programming guide (https://learn.microsoft.com/en-us/windows/win32/direct2d/devices-and-device-contexts) and I wonder if anyone could help me understand the reason behind the following paragraph:

> What is a Direct2D device?
You need a Direct2D device and a Direct3D device to create a Direct2D device context. A Direct2D device (exposes an ID2D1Device interface pointer) represents a display adapter. A Direct3D device (exposes an ID3D11Device interface pointer) is associated with a Direct2D device. Each app must have one Direct2D device, but can have more than one device.
为什么需要3D设备来创建DirectX中的2D设备上下文?

Why do I need a 3D device for creating a 2D device context instead of just creating a 2D device? What is happening behind the scenes and what is the role of the 3D device for rendering 2D graphics?

答案1

得分: 2

以下是已经翻译好的部分:

基本答案是,Direct3D API 与本机支持Direct3D基元(点、单像素线和三角形,可选择使用纹理)的视频驱动程序进行通信。

Direct2D是一个实现“矢量图形”基元的软件层,最终将其扫描转换为Direct3D基元。

DirectWrite使用Direct2D来进行其输出,而Direct2D则使用Direct3D。

Direct2D专门使用Direct3D 10.1。在DirectX 11.1(适用于Windows 8或更高版本,安装了KB2670838的Windows 7)之后,Direct3D 10.1与Direct3D 11之间的互操作由系统处理。在此之前,开发人员需要具备Direct3D 10.1、Direct3D 11和Direct2D设备。

参见矢量图形与位图图形

英文:

The basic answer here is that the Direct3D API talks to the video driver which natively supports Direct3D primitives (points, single-pixel lines, and triangles all with optional textures).

Direct2D is a software layer that implement 'vector graphics' primitives which are ultimately scan-converted into Direct3D primitives.

DirectWrite uses Direct2D to do it's output, which in turn uses Direct3D.

> Direct2D uses Direct3D 10.1 specifically. With DirectX 11.1 (Windows 8 or later, Windows 7 with KB2670838 installed) the interop between Direct3D 10.1 and Direct3D 11 is handled by the system. Prior to that, the developer had to have a Direct3D 10.1, Direct3D 11, and Direct2D device.

See Vector vs. Raster Graphics.

huangapple
  • 本文由 发表于 2023年5月14日 16:36:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/76246571.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定