2

I have this code which check if GL_ARB_sparse_texture is supported:

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;
        }

It prints out that it is supported. Problem is that my shader says it is not:

#version 450 core
#extension GL_ARB_sparse_texture : require

output: enter image description here

I have GTX 660Ti with 350.12 drivers on windows 8.1.

What am I doing wrong?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Jozef Culen
  • 344
  • 1
  • 2
  • 10
  • 3
    [The `ARB_sparse_texture` spec](https://www.opengl.org/registry/specs/ARB/sparse_texture.txt) doesn't look like it extends GLSL. – genpfault May 07 '15 at 20:33

1 Answers1

2

As genpfault said in the comment, only extensions that add features to the GLSL language need to be enabled manually in the shader with the #extension directive. Since GL_ARB_sparse_texture doesn't add GLSL functionality, you don't need to explicitly enable it in your shaders - checking support with glGetIntegerv is enough.

If an extension modifies the GLSL specification (such as ARB_shader_subroutine), it is mentioned in the extension specification.

Arttu Peltonen
  • 1,250
  • 14
  • 18