I have a problem of when or how to use glBindBufferBase. I have set up a UBO as follows:
Code :
    glGenBuffers(1, &fUBOBuffer);
    glBindBuffer(GL_UNIFORM_BUFFER, fUBOBuffer);
    glBufferData(GL_UNIFORM_BUFFER, sizeof(Data), NULL, GL_STREAM_DRAW);
    glBindBuffer(GL_UNIFORM_BUFFER, 0);
    fUBOidx = glGetUniformBlockIndex(fProgram, "GlobalData");
    glUniformBlockBinding(fProgram, fUBOidx, 0);
 
    glBindBufferBase(GL_UNIFORM_BUFFER, 0, fUBOBuffer);
fUBOidx will get a valid value (neither 0 nor GL_INVALID_INDEX), and there is no error reported by OpenGL. Then I transfer data (projection matrix and view matrix) once every frame. I only have one UBO, and use slot 0 for it.
Code :
    glBindBuffer(GL_UNIFORM_BUFFER, fUBOBuffer);
    glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(Data), &data);
    glBindBuffer(GL_UNIFORM_BUFFER, 0);
Problem is, the data isn't available always to the shader. If I play around, additionally calling glBindBufferBase() from "other places", it seems to improve the situation. But I don't think that should be needed? Am I missing something stupid?

Does it depend on the currently program? I can't find any documentation that it does.

Is anything needed to be fulfilled before the call, except having a value for the UBO?

Does the UBO has to be bound?

The application was working fine when I used traditional uniforms.