在 OpenGL 中使用 PNG 纹理的最快、最简单的方法
我正在寻找在 OpenGL 中使用 PNG(带有 alpha 值)纹理的最快、最简单的方法。我尝试过许多不同的库,但大多数都臃肿且难以在 Mac 上编译/工作。
我对 OpenGL 纹理和所有“陷阱”不是很熟悉,所以我把重点放在简单上。
如果解决方案涉及链接库,如果有人能给我一个很好的 makefile 示例,那将非常有帮助。
谢谢!
I am looking for the fastest and easiest way to use PNG (with alpha values) textures in OpenGL. I have tried many different libraries but most are bloated and hard to get compiled/working on a Mac.
I'm not very familiar with OpenGL textures and all of the "Gotchas" so I am putting emphasis on the Simple.
It would be very helpful if someone could give me a nice makefile example if the solution involves linking a library.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以尝试一下SOIL。
You might give SOIL a whirl.
sdl 和 sdl_image 是我所知道的最简单的方法:
http://www.libsdl.org/
http://www.libsdl.org/projects/SDL_image/
但是,这是跨平台的。对于仅适用于 Mac,我想有一个本地替代方案。
sdl and sdl_image is the simplest way I know of:
http://www.libsdl.org/
http://www.libsdl.org/projects/SDL_image/
However, this is for cross-platform. For Mac-only I guess there is a native alternative.
DevIL 可以非常简单轻松地完成此操作,适用于多种格式。它还有一个与 OpenGL 非常非常相似的 API(根据设计,大多数常量是相同的,等等)。我只花了几分钟就将它连接到我拥有的 OpenGL 应用程序中。这些文档不是很好,但它可以完成工作并且支持很多格式。
DevIL can do this pretty simply and easily, for quite a few formats. It also have a very, very similar API to OpenGL (by design, most constants are identical, etc). It took me just a few minutes to hook it into an OpenGL app I had. The docs aren't great, but it does the job and supports a lot of formats.
glpng 是一个 png opengl 加载器实用程序库,尽管人们可以做它所做的事情只需 libpng 和 gl,它就可以在一次调用中从 png 文件加载到纹理中
glpng is a png opengl loader utility library although one can do what it does with just libpng and gl it loads from a png file into a texture for you in one call