androidopengl-esgrafika

Texture2dProgram - where is the glUniform for sTexture defined


looking at the code in Texture2dProgram.java I cannot find the where the uniform for sTexture is defined. Others like aPosition are defined in the constructor.

Being a novice in opengl it looks like the fragment shader uses the current texture unit and a texture is bound to that texture unit so is sTexture a default pre defined name.


Solution

  • There is nothing magic about sTexture. It's a sampler2D, which has a default value of 0 (or GL_TEXTURE0), which is what we want. There's no need to change its value, hence no need to get the uniform address.