呈现BMP,JPEG,或PNG图像与DirectX?图像、JPEG、BMP、DirectX

2023-09-08 10:39:28 作者:ん各种小曲各种嗨〃ぐ

你如何呈现在Windows中3D为BMP,JPEG或PNG图像文件与DirectX? (例如,让我们说,我想渲染四象,使他们看起来像一个小隔间或什么的。)

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 9: D3DXCreateTextureFromFile

的DirectX 10: D3DX10CreateTextureFromFile 和< A HREF =htt​​p://msdn.microsoft.com/en-us/library/bb172667%28v=VS.85%29.aspx相对=nofollow> 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/

从样本和资源部分下载源$ C ​​$ C第二部分。看第7章源$ C ​​$ C样本。或者,你可以购买这本书。

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.