使用 DirectX 渲染 BMP、JPEG 或 PNG 图像?
如何在 Windows 中使用 DirectX 以 3D 形式呈现 BMP、JPEG 或 PNG 图像文件?(例如,假设我想渲染四个图像,使它们看起来像一个小隔间之类的东西.)
How do you render a BMP, JPEG, or PNG image file in 3D with DirectX in Windows? (E.g. let's say I want to render four images so that they look like a cubicle or something.)
我已经看到使用 Java OpenGL 库轻松完成此操作(我认为是 JME?),但似乎 DirectX 需要纹理,并且不接收常规图像.:(
I've seen this done easily with a Java OpenGL library (JME I think?), but it seems like DirectX needs textures, and doesn't take in regular images. :(
这是正确的吗?如果是这样,我如何以编程方式将其转换为纹理?
Is this correct? If so, how do I convert it to a texture programmatically?
DirectX 9:D3DXCreateTextureFromFile
DirectX 10:D3DX10CreateTextureFromFile 和 D3DX10CreateShaderResourceViewFromFile
DirectX 10: D3DX10CreateTextureFromFile and D3DX10CreateShaderResourceViewFromFile
DirectX 11:D3DX11CreateTextureFromFile 和 D3DX11CreateShaderResourceViewFromFile
DirectX 11: D3DX11CreateTextureFromFile and D3DX11CreateShaderResourceViewFromFile
阅读每个文件的详细信息,但大多数流行的文件格式都受支持.(包括 BMP、JPG 和 PNG)
Read the details of each, but most all of the popular file formats are supported. (includes BMP, JPG, and PNG)
去这里:http://www.jblearning.com/catalog/9781598220537/
从示例和资源"部分下载源代码第二部分".查看第 7 章源代码示例.或者,您可以购买这本书.
Download the "source code part II" from the "samples and resources" section. Look at the chapter 7 source code samples. Optionally, you could buy the book.