I am not 100% sure if this will fix your problem or not; but I don't see anything wrong with your flags to initialize the texture settings. When I compared your code with my project, it drew attention to API calls. In your source you have this order:
glGenTextures(...); // Generate glActiveTexture(...); // Set Active glBindTexture(...); // Bind Texture glTexParameteri(...); // Wrap Setting glTexParameteri(...); // Wrap Setting glTexParameteri(...); // Mipmap Setting glTexParameteri(...); // Mipmap Setting glBindTexture(...); // Bind / Unbind
and you repeat this for each texture, except for passing the texture variable and increasing the id value.
I do not know if this will matter, but with my engine and the logical path that I set; try to do it in this order and see it doesn't matter
glGenTextures(...); // Generate glBindTexture(...); // Bind Texture glTexParameteri(...); // Wrap Setting glTexParameteri(...); // Wrap Setting glTexParameteri(...); // Mipmap Setting glTexParameteri(...); // Mipmap Setting glActiveTexture(...); // Set Active glBindTexture(...); // Bind / Unbind
I do not use computational shaders, but inside my engine I have several classes that manage different things. I have an asset repository that will save all assets to a memory database, including textures for images, I have a ShaderManager class for managing different shaders that currently only use vertex and fragment shaders. It will read and compile shader files, create shader programs, set attributes and uniforms, link programs and run shaders. I use a batch process where I have a batch class and a package manager class to render various types of primitives. Therefore, when I went through my decision and following a path or logic, this is what I saw in my code.
It was the AssetStorage class that set up the texture properties and called these API calls in that order within its add() function to add textures to memory.
glGenTextures(...); glBindTextures(...); glTexParameteri(...); glTexParameteri(...); glTexParameteri(...); glTexParameteri(...);
Then AssetStorage also called them
glPixelStorei(...); glTexImage2D(...)
And the function of adding textures in AssetStorage will finally return the user structure of the TextureInfo object.
When I checked my Batch class under its call to the render() function, this is where it called the ShaderManager function to set the uniform to use the textures, then called the ShaderManager function to set the texture, and then set it even again if the texture contained alpha channel. In the ShaderManger class for the setTexture() function, this is where glActiveTexture() and glBindTexture() finally called.
So, in a brief summary, try moving your glActiveTexture() call between the last glTexParameter() and the last glBindTexture() calls for both textures. I think that this should also appear after these two calls, as well as glPixelStorei() and glTexImage2D() because you want to make the texture active the same way you are going to render it.
As I mentioned earlier, I'm not 100% sure if this is the main cause of your problem, but I think it's worth a try, trying to figure out if it helps you or not. Please let me know what happens if you try this. I would like to know for myself if the ordering of these API calls has some effect on it. I would try this in my own solution, but I do not want to break my classes or project because it is currently working correctly.
As a side note, the only one with flags for your texture settings is in the wrap / repeat sections. Instead, you can use GL_REPEAT for the first two calls to glTexParameteri() instead of GL_CLAMP_TO_EDGE and tell me what you came up with, you do not need to worry about the mipmap settings for the last two glTexParameteri() because it seems that you are not using mipmaps from the settings that you use.