我有这样的代码来检查是否支持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产出:

我有GTX 660 on和350.12驱动程序在Windows8.1。
我做错了什么?
发布于 2015-05-08 07:30:20
正如genp断层在注释中所指出的,只有为GLSL语言添加功能的扩展才需要在着色器中手动启用#extension指令。因为GL_ARB_sparse_texture没有添加GLSL功能,所以您不需要在着色器中显式地启用它--使用glGetIntegerv检查支持就足够了。
如果扩展修改了GLSL规范(例如子程序),扩展规范中就提到了它。
https://stackoverflow.com/questions/30110812
复制相似问题