gpt4 book ai didi

linux - 当 GLEW_ARB_framebuffer_object 非零时,为什么 glFramebufferTexture 是 NULL 指针?

转载 作者:太空狗 更新时间:2023-10-29 11:37:39 25 4
gpt4 key购买 nike

我的代码大致是这样的:

GLenum glewStatus = glewInit();
if (glewStatus != GLEW_OK)
exit(1);

if (!GLEW_ARB_framebuffer_object)
exit(1);

printf("%p\n", glFramebufferTexture);

这会打印 0,这就解释了为什么调用 glFramebufferTexture() 会立即出现段错误。

但是,为什么是0呢?许多其他帧缓冲区函数工作正常(例如 glBindFramebufferglFramebufferRenderbufferglBindFramebuffer)。

我是否需要以不同方式初始化 GLEW 或扩展?

最佳答案

glFramebufferTexture() 是比 glBindFramebuffer() 和其他 FBO 相关入口点更新的入口点。在核心 OpenGL 规范中,glFramebufferTexture() 是在 3.2 中添加的,而其余的 FBO 功能是 3.0 的一部分。 glFramebufferTexture() 也不是 ARB_framebuffer_object 的一部分。

在大多数情况下,您可以使用 glFramebufferTexture2D(),这是原始 FBO 功能的一部分。 glFramebufferTexture() 仅对于纹理数组、立方体贴图等不同。

关于linux - 当 GLEW_ARB_framebuffer_object 非零时,为什么 glFramebufferTexture 是 NULL 指针?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23550052/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com