使用 DirectX 渲染 BMP、JPEG 或 PNG 图像? [英] Render a BMP, JPEG, or PNG Image with DirectX?

查看:36
本文介绍了使用 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:D3DX10CreateTextureFromFileD3DX10CreateShaderResourceViewFromFile

DirectX 10: D3DX10CreateTextureFromFile and D3DX10CreateShaderResourceViewFromFile

DirectX 11:D3DX11CreateTextureFromFileD3DX11CreateShaderResourceViewFromFile

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.

这篇关于使用 DirectX 渲染 BMP、JPEG 或 PNG 图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆