Hello all,
I have a quick question for you guys as I have been toying with OpenGL recently and trying to figure out how the layout(shared) works? My understanding was that OpenGL would assign the same block offset for all shader proigrams using the same uniform block when declared with layout(shared).
For instance, I have a shared uniform block:
layout(shared) uniform ubContext
{
mat4 projectionViewMatrix;
mat4 projectionMatrix;
mat4 viewMatrix;
float time;
float cosTime;
} Context;
What I am trying to do is share it across multiple programs. Essentially, I tried creating a single UBO from the block, fill it with data once at the very beginning of a frame, bind it and expect all the shader programs using it to able to read from it. I
This does not seem to work and I am currently having to create & bind one UBO per shader program.
Shouldn't the data be persistent across several draw calls ? Do I need to explicitly assign the block indices myself (I thought shared would do it "automatically")?
Am I missing something there or is this not how the shared layout works?
Thanks in advance,