Ember

textures

Jan 16th, 2014
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.46 KB | None | 0 0
  1.         // Load the Texture
  2.         D3D11_TEXTURE2D_DESC textureDesc;
  3.         ZeroMemory(&textureDesc, sizeof(textureDesc));
  4.         textureDesc.Width = 512;
  5.         textureDesc.Height = 512;
  6.         textureDesc.MipLevels = 10;
  7.         textureDesc.ArraySize = 1;
  8.         textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
  9.         textureDesc.SampleDesc.Count = 1;
  10.         textureDesc.SampleDesc.Quality = 0;
  11.         textureDesc.Usage = D3D11_USAGE_IMMUTABLE;
  12.         textureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
  13.         textureDesc.CPUAccessFlags = 0;
  14.         textureDesc.MiscFlags = 0;
  15.  
  16.         Byte textureMip0[512][512];
  17.         Byte textureMip1[256][256];
  18.         Byte textureMip2[128][128];
  19.         Byte textureMip3[64][64];
  20.         Byte textureMip4[32][32];
  21.         Byte textureMip5[16][16];
  22.         Byte textureMip6[8][8];
  23.         Byte textureMip7[4][4];
  24.         Byte textureMip8[2][2];
  25.         Byte textureMip9[1][1];
  26.  
  27.         D3D11_SUBRESOURCE_DATA textureData[10];
  28.         ZeroMemory(&textureData, sizeof(textureData));
  29.         textureData[0].pSysMem = textureMip0;
  30.         textureData[0].SysMemPitch = 0;
  31.         textureData[0].SysMemSlicePitch = 0;
  32.         textureData[1].pSysMem = textureMip1;
  33.         textureData[1].SysMemPitch = 0;
  34.         textureData[1].SysMemSlicePitch = 0;
  35.         textureData[2].pSysMem = textureMip2;
  36.         textureData[2].SysMemPitch = 0;
  37.         textureData[2].SysMemSlicePitch = 0;
  38.         textureData[3].pSysMem = textureMip3;
  39.         textureData[3].SysMemPitch = 0;
  40.         textureData[3].SysMemSlicePitch = 0;
  41.         textureData[4].pSysMem = textureMip4;
  42.         textureData[4].SysMemPitch = 0;
  43.         textureData[4].SysMemSlicePitch = 0;
  44.         textureData[5].pSysMem = textureMip5;
  45.         textureData[5].SysMemPitch = 0;
  46.         textureData[5].SysMemSlicePitch = 0;
  47.         textureData[6].pSysMem = textureMip6;
  48.         textureData[6].SysMemPitch = 0;
  49.         textureData[6].SysMemSlicePitch = 0;
  50.         textureData[7].pSysMem = textureMip7;
  51.         textureData[7].SysMemPitch = 0;
  52.         textureData[7].SysMemSlicePitch = 0;
  53.         textureData[8].pSysMem = textureMip8;
  54.         textureData[8].SysMemPitch = 0;
  55.         textureData[8].SysMemSlicePitch = 0;
  56.         textureData[9].pSysMem = textureMip9;
  57.         textureData[9].SysMemPitch = 0;
  58.         textureData[9].SysMemSlicePitch = 0;
  59.  
  60.         ID3D11Texture2D* mTexture;
  61.         result = mDevice->CreateTexture2D(&textureDesc, textureData, &mTexture);
Advertisement
Add Comment
Please, Sign In to add comment