locked
Creating dynamic texture with DXGI_FORMAT_R8_UNORM gives me only red channel RRS feed

  • Question

  • Hi.....

    I am creating a dynamic texture for luminance as shown bellow, the prblem is when i render the texture it gives me only the red channel i don't know what i'm doin wrong. Please help me or point me to the correct way....

    // Create texture
    
    HRSULT hr;
     D3D11_TEXTURE2D_DESC desc;
     desc.Width = width;
     desc.Height = height;
     desc.Format = DXGI_FORMAT_R8_UNORM;
     desc.MipLevels = 1;
     desc.ArraySize = 1;
     desc.SampleDesc.Count = 1;
     desc.SampleDesc.Quality = 0;
     desc.Usage = D3D11_USAGE_DEFAULT;
     desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
     desc.CPUAccessFlags = 0;
     desc.MiscFlags = 0;
    
     ID3D11Texture2D* tex = nullptr;
     hr =m_d3dDevice->CreateTexture2D(
       &desc,
       NULL,
       &tex);


    Developer

    Friday, January 18, 2013 2:13 AM