DX11 Primer Tutorial 01: Creation of basic features Directxsamplebrowser (June 2010)

Source: Internet
Author: User

Goal: Quick Start these days dx11

The first is mainly about the creation of basic elements: device, context, view, swap;

Notes:

1.In Direct3D, the device object is used to perform both rendering and resource creation. In Direct3D One, the immediate context is used by the application to perform rendering onto a buffer, and the device Contai NS methods to create resources.

is to say: Two pieces of graphics: resource creation and rendering; dx11 direct device implementation, now the context rendering module render buffer, device management resource creation.

2.The front buffer is a being presented currently to the user. This buffer is read-only and cannot are modified. The back buffer was the render target to which the device would draw. Once It finishes the drawing operation, the swap chain would present the backbuffer by swapping the buffers. The back buffer becomes the front buffer, and vice versa.

Buffer: Front buffer read-only, used to display to us, back buffer for render, is what we actually draw ; When a drawing operation is completed, swap chain will switch between front and back

3.A Resource View allows a resource to being bound to the graphics pipeline at A specific stage. We need to create a render target view because we would like to bind the back buffer of our swap chain as a render target.

Rendertargetview the creation of associated resources and binding to Backbuffer:

Create a render target viewid3d11texture2d* pbackbuffer = NULL;HR = G_pswapchain->getbuffer (0, __uuidof (id3d11text ure2d), (lpvoid*) &pbackbuffer);//swapchian get Backbuffer,if (FAILED (HR)) return HR;HR = g_pd3ddevice-> Createrendertargetview (Pbackbuffer, NULL, &g_prendertargetview);//Device creates a resource and binds to Backbuffer Pbackbuffer->release (); if (FAILED (HR)) return Hr;g_pimmediatecontext->omsetrendertargets (1, &g_ Prendertargetview, NULL);//Context Settings rendering: Backbuffer content

4.The viewport maps clip space coordinates, where X and Y range from-1 to 1 and Z ranges from 0 to 1,we set the top left Point to (0, 0) and width and height to is identical to the render target ' s size.

In the viewport coordinate system, the XY origin is in the upper-left corner. The range of Z is 0 to 1

Summarize the following process:

1. Create device, context, Swapchain

2.swapChain gets a backbuffer, device creates rendertargetview and binds Buffer,context sets the render target,

Creation of 3.viewport

4. Modify the window response to listen but do not block, while non-blocking when the graphics render

5.render ()

DX11 Primer Tutorial 01: Creation of basic features Directxsamplebrowser (June 2010)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.