我有这个代码来检查是否支持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
输出:
我在 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/