Hi Alfonse,
I’m sorry, I tried to be as precise as possible, but I managed not to ![]()
I used X in my previous message to express that the two programs have the same homonymous handle in the two contexts.
Namely, I used glCreateProgram in the first context, I got as handle 15; then I used it again in the second context and 15 was the return value again.
So, what I expected was (I will use the actual uniform name in the following):
- Make context A current → glUseProgram(15) → glGetUniformLocation(15, “MVP”) → yields 15
- Make context B current → glUseProgram(15) → glGetUniformLocation(15, “MVP”) → yields 67
- Make context A current again → glUseProgram(15) → glGetUniformLocation(15, “MVP”) → yields 15
Instead, what I got was:
- Make context A current → glUseProgram(15) → glGetUniformLocation(15, “MVP”) → yields 15
- Make context B current → glUseProgram(15) → glGetUniformLocation(15, “MVP”) → yields 67
- Make context A current again → glUseProgram(15) → glGetUniformLocation(15, “MVP”) → yields 67 again
I know that I cannot choose any of the values, but that’s ok, I’m not interested in that.
The fact of the matter is I get the wrong uniform location after this ping-pong context switch A→B→A
I was to understand that after a shader is compiled and linked in a given context, its uniform locations would remain the same when this very context is made current again;
even if the locations change (it would not be a great deal for me), I expect them to be reasonable values; instead, I receive a value greater than -1, but that refers to no actual uniform location (glUniformMatrix4fv causes GL_INVALID_OPERATION: I checked for all the other cases that can cause this, the wrong uniform location is the only one I couldn’t sort out).
To me, it smells that I receive the very same uniform location of the program with the same handle value from another context; but I may be wrong: that’s also part of why I’m asking here ![]()
Please, let me know if I managed to better explain myself this time, or if I need to provide more details: thanks! ![]()