Directx 11 Tutorial 1

Create device,Immediate context, Swap chain

device

    1. methods
    2. create resource

Immediate context    perform rendering onto buffer

Swap chain          

Take the buffer to device render, display the context on monitor

    1. front buffer    present currnetly to user , read only, can’t be modified.
    2. back buffer   render target to which device will draw.

To create the swap chain,we fill out a DXGI_SWAPCHAIN_DESC structure that describes the swap chain we are about to create.

BackBufferUsage is a flag that tells the application how the back buffer will be used

OutputWindow field represents the window that the swap chain will use to present images on the screen.

 resource view

A resource view allows a resource to be bound to the graphics pipeline at a specific stage.

Creating different resource views to bind that texture to different stages in the graphics pipeline

GetBuffer() to get the back buffer object

OMSetRenderTargets() on the immediate context to bind it to the pipeline.

viewport

The viewport maps clip space coordinates, where X and Y range from -1 to 1 and Z ranges from 0 to 1, to render target space, sometimes known as pixel space.In Direct3D 11, no viewport is set by default. Therefore, we must do so before we can see anything on the screen.

Modifying the Message Loop

GetMessage() is that if there is no message in the queue for the application window, GetMessage() blocks and does not return until a message is available.

when there is no message waiting, PeekMessage() returns immediately instead of blocking.

 

The Rendering Code

Rendering is done in the Render() function.

fill the render target with a single color is to use the immediate context’s ClearRenderTargetView() method.

define an array of four floats that describe the color with which we would like to fill the screen. Then, we pass it to ClearRenderTargetView().

Post a comment or leave a trackback: Trackback URL.

發表留言