0

OpenGL function glGetActiveUniformBlockName() is documented here. The short description reads: [it] retrieves the name of the active uniform block at uniformBlockIndex within program.

How can I make an uniform block active?

qdii
  • 11,387
  • 7
  • 54
  • 107

1 Answers1

2

A uniform block is active in the same way that a uniform is active: you use it in some series of expressions that yields an output. If you want a uniform block to be active, you need to actually do something with one of its members that materially affects the outputs of a shader.

Nicol Bolas
  • 378,677
  • 53
  • 635
  • 829
  • 1
    compiler usually tries to optimize the code and for instance removes the unused variables - uniforms for this purpose. You can use "#pragma optimize(off)" to test the shader... – fen May 05 '12 at 08:07
  • Can you fen? Is that driver specific? I been looking for details of some way of using a pre-processor type directives with shaders but haven't found much info. Actually started writing my own parser to allow me to do conditional compilation and things like that! – Robinson May 05 '12 at 15:08
  • @Robinson: How much the driver listens to that #pragma is driver-specific, but the existence of it is mandatory. And GLSL has a full pre-processor, just like C (more or less). – Nicol Bolas May 05 '12 at 15:28