is it possible to render one pixel using DirectX 11? if its possible how to do it ?
-
\$\begingroup\$ You can draw a single point and then swap, but why would you do that? \$\endgroup\$– Chuck WalbournCommented Oct 22, 2016 at 0:14
-
\$\begingroup\$ I want to write a software render using DirectX11 just for learning purposes. but what do you mean by drawing a single point and then swap ? \$\endgroup\$– Andre AhmedCommented Oct 22, 2016 at 0:19
-
\$\begingroup\$ Just render a point. \$\endgroup\$– KrythicCommented Oct 22, 2016 at 0:56
-
\$\begingroup\$ You sadly can't learn anything from creating a softwer renderer that's not obsolete or useless \$\endgroup\$– BálintCommented Oct 22, 2016 at 10:55
1 Answer
Your best option is to use a DYNAMIC 2D texture, and each 'frame' copy from a 2D array in system memory that your software renderer produces to the DYNAMIC 2D texture using Map
/Unmap
. You can then render a full-screen quad using your DYNAMIC 2D texture to get it into the render target backbuffer in the DXGI swapchain, and then Present
to swap the buffers.
See How to: Use dynamic resources
You can use
SpriteBatch
in the DirectX Tool Kit to do the 'full-screen quad render' trick of your DYNAMIC texture.
-
\$\begingroup\$ In addition to textures, could also use the vertex buffer or a cbuffer (or any of the other buffers really) \$\endgroup\$ Commented Oct 22, 2016 at 3:11
-
\$\begingroup\$ If the OP wants to render the result of a 'software rendererer', this is probably the fastest way rather than drawing
width * height
points. \$\endgroup\$ Commented Oct 22, 2016 at 7:01