opengl - 不支持 GL_ARB_sparse_texture

标签 opengl glsl opengl-extensions

我有这个代码来检查是否支持GL_ARB_sparse_texture:

GLint ExtensionCount = 0;
    glGetIntegerv(GL_NUM_EXTENSIONS, &ExtensionCount);
    for (GLint i = 0; i < ExtensionCount; ++i)
        if (std::string((char const*)glGetStringi(GL_EXTENSIONS, i)) == std::string("GL_ARB_sparse_texture")){
            std::cout << "supported" << std::endl;
        }

它打印出它是受支持的。问题是我的着色器说它不是:

#version 450 core
#extension GL_ARB_sparse_texture : require

输出: enter image description here

我在 Windows 8.1 上拥有配备 350.12 驱动程序的 GTX 660Ti。

我做错了什么?

最佳答案

正如 genpfault 在评论中所说,只有为 GLSL 语言添加功能的扩展才需要在着色器中使用 #extension 指令手动启用。由于 GL_ARB_sparse_texture 不添加 GLSL 功能,因此您无需在着色器中显式启用它 - 使用 glGetIntegerv 检查支持就足够了。

如果扩展修改了 GLSL 规范(例如 ARB_shader_subroutine ),则会在扩展规范中提及。

关于opengl - 不支持 GL_ARB_sparse_texture,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30110812/

相关文章:

c++ - 为什么我收到错误 LNK1104 : cannot open file 'glew32.lib'

linux - opengl与Nvidia gpu

c++ - GLSL 纹理映射,最大纹理数

opengl - 附加了分割着色器时,glDrawArrays失败

c++ - openGL 3 问题 : undefined reference to _glapi_tls_Dispatch

c++ - 调整窗口倾斜显示 (OpenGL)

c++ - OpenGL 延迟渲染不工作

windows - wglext - 扩展未安装在 OpenGL 上下文中

c++ - 如何让各向异性过滤扩展起作用?