Nd3d11 Texture Create From File Site
using Microsoft::WRL::ComPtr;
hr = DirectX::CreateTexture( pDevice, scratchImage.GetImages(), scratchImage.GetImageCount(), metadata, &pTexture ); nd3d11 texture create from file
#include <DirectXTex.h> ID3D11Texture2D* pTexture = nullptr; ID3D11ShaderResourceView* pSRV = nullptr; DirectX::TexMetadata metadata; DirectX::ScratchImage scratchImage; hr = DirectX::CreateTexture( pDevice
HRESULT hr = DirectX::LoadFromDDSFile( L"texture.dds", DirectX::DDS_FLAGS_NONE, &metadata, scratchImage ); ID3D11Texture2D* pTexture = nullptr
UINT width, height; pFrame->GetSize(&width, &height); UINT stride = width * 4; UINT imageSize = stride * height; BYTE* imageData = new BYTE[imageSize]; pConverter->CopyPixels(nullptr, stride, imageSize, imageData); D3D11_TEXTURE2D_DESC desc = {}; desc.Width = width; desc.Height = height; desc.MipLevels = 1; desc.ArraySize = 1; desc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; desc.SampleDesc.Count = 1; desc.Usage = D3D11_USAGE_DEFAULT; desc.BindFlags = D3D11_BIND_SHADER_RESOURCE; desc.CPUAccessFlags = 0; D3D11_SUBRESOURCE_DATA initData = {}; initData.pSysMem = imageData; initData.SysMemPitch = stride;
