Is it possible to send Texture Buffer to shader dynamically? I want to send a series of integer to the geometry shader,
while the data will be modified every frame.
But when I try to retrive the sampleBuffer in geometry shader, it seems to keep output zero.
Am I using Texture Buffer wrong, or the TBO itself just can't be used as GL_DYNAMIC_DRAW?
Init Texture Buffer
void InitialTBO() {
    int index_tbo_reserved_size = 5000;
    glGenBuffers(1, &amp;index_tbo);
    glBindBuffer(GL_TEXTURE_BUFFER, index_tbo);
    glBufferData(GL_TEXTURE_BUFFER, index_tbo_reserved_size * sizeof(GLint), NULL, GL_DYNAMIC_DRAW);
    glGenTextures(1, &amp;index_tbo_tex);
}

Render
void RenderChunkDataCone(Primitive* primitive) {
    Program* shaders = primitive-&gt;shaders;

    shaders-&gt;use();

    glActiveTexture(GL_TEXTURE0);   
    glBindBuffer(GL_TEXTURE_BUFFER, this-&gt;index_tbo);
    glBufferSubData(GL_TEXTURE_BUFFER, 0, sizeof(GLint)*index_tbo_data.size(), index_tbo_data.data());
    glBindTexture(GL_TEXTURE_BUFFER, this-&gt;index_tbo_tex);
    glTexBuffer(GL_TEXTURE_BUFFER, GL_R32I, this-&gt;index_tbo);
    shaders-&gt;setUniform(&quot;index_tex&quot;, 0);

    glBindVertexArray(primitive-&gt;vao);
    glDrawElements(primitive-&gt;drawType, primitive-&gt;drawCount * primitive-&gt;drawCount_Inner, GL_UNSIGNED_INT, 0);

    glBindVertexArray(0);
    shaders-&gt;stopUsing();
}

Geometry Shader
#version 460 core
uniform samplerBuffer index_tex;
vec3 render_primitive(vec3 position){
    int status = int(texelFetch(index_tex, 0).r);
    if(status==0)
        return vec3(0,10,10);
    else if(status==1)
        return vec3(10,0,0);
    else if(status==2)
        return vec3(0,0,10);
}

void main() {
    vec4 position =gl_in[0].gl_Position;
    vec3 returnedValue = render_primitive(position.xyz);
}

I've confirmed the index_tbo[0] is 1,
But the returnedValue outputed by shader will always be (0,10,10) as the value index_tex[0] received seems to be 0.
These:

glTexBuffer(GL_TEXTURE_BUFFER, GL_R32I, this-&gt;index_tbo);



uniform samplerBuffer index_tex;


Do not match. If the texture is a signed integer texture, then the sampler type needs to match. It should be isamplerBuffer, and you won't need to do the cast.