I am very new to Direct X 11. I want to create a simple 2d texture (of type ID3D11Texture2D). I have read document about CreateTexture2D and I understand that:
pDesc is how we define the image.
pInitialData contains the array of bytes presents every pixel of the image texture
ppTexture2D is our result - the 2D texture for DirectX 11.
I want to create a very simple 2D texture: a pink rectangle. But I don't know how to create the array of bytes for the pink rectangle. I have the code below:
D3D11_TEXTURE2D_DESC Desc;
D3D11_SUBRESOURCE_DATA InitialData;
ID3D11Texture2D* pTexture2D;
Desc.Usage = D3D11_USAGE_DEFAULT;
BYTE* array;//How to have an array of Pink rectangle?
InitialData.pSysMem = array;
InitialData.SysMemPitch = 0;
InitialData.SysMemSlicePitch = 0;
m_device->CreateTexture2D(&Desc, &InitialData, &pTexture2D);//ID3D11Device m_device has been created before.
Thank you very much.