User Tools

Site Tools


tutorial_201_20-_20_20direct3d_2011_20basics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tutorial_201_20-_20_20direct3d_2011_20basics [2018/03/31 13:19]
127.0.0.1 external edit
tutorial_201_20-_20_20direct3d_2011_20basics [2018/04/13 22:27] (current)
richardrussell Added syntax highlighting
Line 7: Line 7:
 \\  The source files, libraries etc. may be downloaded from [[http://​www.rtr.myzen.co.uk/​D3D11tutorial.zip|here]].\\ \\  \\  The source files, libraries etc. may be downloaded from [[http://​www.rtr.myzen.co.uk/​D3D11tutorial.zip|here]].\\ \\ 
 ===== Setting Up The Direct3D 11 Device ===== ===== Setting Up The Direct3D 11 Device =====
-\\  The following is the code to create a **device** and a **swap chain**:\\ \\ +\\  The following is the code to create a **device** and a **swap chain**: 
 + 
 +<code bb4w>
         DIM sd{} = DXGI_SWAP_CHAIN_DESC{}         DIM sd{} = DXGI_SWAP_CHAIN_DESC{}
         sd.BufferCount% = 1         sd.BufferCount% = 1
Line 28: Line 30:
         !(^ID3D11Device{}+4) = !pd3dDevice%         !(^ID3D11Device{}+4) = !pd3dDevice%
         !(^ID3D11DeviceContext{}+4) = !pImmediateContext%         !(^ID3D11DeviceContext{}+4) = !pImmediateContext%
-\\  ​The code to create and set the **render target view** is as follows:\\ \\ +</​code>​ 
 + 
 +The code to create and set the **render target view** is as follows: 
 + 
 +<code bb4w>
         REM Create a render target view:         REM Create a render target view:
         SYS IDXGISwapChain.GetBuffer%,​ pSwapChain%,​ 0, IID_ID3D11Texture2D,​ \         SYS IDXGISwapChain.GetBuffer%,​ pSwapChain%,​ 0, IID_ID3D11Texture2D,​ \
Line 43: Line 49:
         SYS ID3D11DeviceContext.OMSetRenderTargets%,​ pImmediateContext%,​ \         SYS ID3D11DeviceContext.OMSetRenderTargets%,​ pImmediateContext%,​ \
         \   1, ^pRenderTargetView%,​ NULL         \   1, ^pRenderTargetView%,​ NULL
-\\  ​The last thing we need to set up before Direct3D 11 can render is initialize the **viewport**:​\\ \\ +</​code>​ 
 + 
 +The last thing we need to set up before Direct3D 11 can render is initialize the **viewport**:​ 
 + 
 +<code bb4w>
         DIM vp{} = D3D11_VIEWPORT{} : REM All members are floats         DIM vp{} = D3D11_VIEWPORT{} : REM All members are floats
         vp.Width% = FN_f4(Width%)         vp.Width% = FN_f4(Width%)
Line 53: Line 63:
  
         SYS ID3D11DeviceContext.RSSetViewports%,​ pImmediateContext%,​ 1, vp{}         SYS ID3D11DeviceContext.RSSetViewports%,​ pImmediateContext%,​ 1, vp{}
-\\ +</​code>​ 
 ===== The Rendering Code ===== ===== The Rendering Code =====
-\\  In this tutorial, we will render the simplest scene possible, which is to fill the screen with a single colour:\\ \\ +\\  In this tutorial, we will render the simplest scene possible, which is to fill the screen with a single colour: 
 + 
 +<code bb4w>
         REM Clear the back buffer:         REM Clear the back buffer:
         DIM ClearColor%(3)         DIM ClearColor%(3)
Line 64: Line 77:
         REM Present the information rendered to the back buffer:         REM Present the information rendered to the back buffer:
         SYS IDXGISwapChain.Present%,​ pSwapChain%,​ 0, 0         SYS IDXGISwapChain.Present%,​ pSwapChain%,​ 0, 0
 +</​code>​
tutorial_201_20-_20_20direct3d_2011_20basics.txt · Last modified: 2018/04/13 22:27 by richardrussell