本文介绍了如何在 GLUT 上加载 bmp 以将其用作纹理?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我一直在四处寻找一个简单的解决方案,以在 C++ 中为我的 OpenGl GLUT 简单月球着陆器游戏添加精灵,看来我必须使用 bmp,因为它们最容易加载并用作矩形上的纹理.
I've been searching all around for a simple solution to add sprites to my OpenGl GLUT simple moon lander game in c++ and it appears I must use bmp's since they're easiest to load and use them as textures on a rectangle.
我究竟如何将 bmp 加载为纹理?
How exactly can I load the bmp's as textures though?
推荐答案
看我简单的c实现函数加载纹理.
Look my simple c implementation function to load texture.
以上函数返回纹理数据.将纹理数据存储在变量中
Above function returns the texture data. Store the texture data in variable
现在您可以使用 glBindTexture 绑定纹理
Now you can bind the texture using glBindTexture
这篇关于如何在 GLUT 上加载 bmp 以将其用作纹理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!