You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I am currently using DirectX 11 for rendering some images. I am using the OpenImageIO library to read image data and upload it to a D3D texture. However, D3D has some specific requirements for texture formats: it must be 4-byte aligned, and the format type should be DXGI_FORMAT_R8G8B8A8_UNORM. This means that I must have an Alpha channel, even if it's a regular 8-bit JPG image that doesn't have an Alpha channel. I would like to know if there is a method in C++ to quickly add an Alpha channel to image data.
One method I have thought of is to store the RGB data separately in different arrays, then merge them together and add an Alpha channel after each RGB pixel. Is this approach acceptable? Are there any efficiency issues, or is there a faster way to achieve this? Thank you very much.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I am currently using DirectX 11 for rendering some images. I am using the OpenImageIO library to read image data and upload it to a D3D texture. However, D3D has some specific requirements for texture formats: it must be 4-byte aligned, and the format type should be DXGI_FORMAT_R8G8B8A8_UNORM. This means that I must have an Alpha channel, even if it's a regular 8-bit JPG image that doesn't have an Alpha channel. I would like to know if there is a method in C++ to quickly add an Alpha channel to image data.
One method I have thought of is to store the RGB data separately in different arrays, then merge them together and add an Alpha channel after each RGB pixel. Is this approach acceptable? Are there any efficiency issues, or is there a faster way to achieve this? Thank you very much.
Beta Was this translation helpful? Give feedback.
All reactions