c++ - 如何在 OpenGL 3.3 中实现 3d 纹理

标签 c++ opengl 3d textures

所以我刚刚意识到我为 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/

相关文章:

c++ - 我应该使用 XPath 还是只使用 DOM?

javascript - 使用 javascript 显示 CAD 图像

c# - Helix toolkit 旋转 3D 模型

c++ - 在结构的 std::vector 中查找

c++ - 在带有 GCC 的生产环境中使用 C++11

c++ - 比较两个字符串的每个字符。新的和寻找输入

c++ - 在 openGL 中,我如何从内存中编辑特定的顶点缓冲区属性

c++ - 使用 OpenGL 着色器在 C++ 中以 2D 形式绘制 4D 点

opengl - 绘制相交圆的轮廓

css - 如何在使用 css 3d 变换向外倾斜时向前倾斜内部元素