When a texture (2D) is supplied to a shader as a 'uniform' input, it is first uploaded to OpenGL using glTexImage2D() and then using glUniform1i() it is associated to shader uniform.
eg code :
Texture data
glTexImage2D()
: is used to transfer texture data to the server side
glGetUniformLocation()
: is used to access shader uniform handle
glUniform1i()
: associates the data pointed by texture unit to the shader 'uniform'
but when we pass matrix (eg matrix4x4) to a shader as a 'uniform' input, when don't use any specific function to upload it to OpenGL.
(we just used to glUniform..() to associate the data with the shader input which we also used in the case of texture data)
Matrix data
glGetUniformLocation()
: to access shader uniform handle
glUniformMatrix4fv()
: to associate matrix data to the shader uniform input.
Where does the matrix data live in each step in the process of passing it to a shader as a uniform input?
Does matrix data always live on client side/ CPU accessible memory and fetched every frame by server side?
If it is uploaded to OpenGL:
which step/function call uploads the data?
where does the data live in OpenGL memory?
how its memory location is pointed?