所以我刚刚意识到我为 3d 纹理编写的代码适用于 OpenGL 1.1 或其他版本,并且在 OpenGL 3.3 中不再受支持。如果没有 glTexture3D,还有另一种方法可以做到这一点吗?也许是通过库或我不知道的 OpenGL 3.3 中的其他函数?
编辑: 我不确定我在哪里读到 3d 纹理在较新版本中从 OpenGL 中删除(今天一直在谷歌搜索),但考虑一下:
我一直在关注教程/指南 here .该程序编译顺利。现在阅读文章中的以下引述:
The potential exists that the environment the program is being run on does not support 3D texturing, which would cause us to get a NULL address back, and attempting to use a NULL pointer is A Bad Thing so make sure to check for it and respond appropriately (the provided example exits with an error).
该引用指的是以下函数:
glTexImage3D = (PFNGLTEXIMAGE3DPROC) wglGetProcAddress("glTexImage3D");
在我的计算机(具有 OpenGL 3.3)上运行我的程序时,相同的函数为我返回 null。当我的 friend 在他的计算机(具有 OpenGL 1.2)上运行它时,它不会返回 null。
最佳答案
自 OpenGL-1.2 以来,上传 3D 纹理的方式没有改变。这个函数仍然命名
glTexImage3D
glTexSubImage3D
glCopyTexSubImage3D
关于c++ - 如何在 OpenGL 3.3 中实现 3d 纹理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11659050/