Is calling glActiveTexture(GL_TEXTURE0 + i); where i = 0 not a valid active texture slot? As far as I’m aware I should be able to bind to this slot, but when I do the polygon it’s bound to is rendered black, I don’t have any all black textures. ???
It is valid. You may have an incomplete texture (mipmap filtering enabled but no mipmaps) for example which would result in black.
OK, just making sure. I don’t think it was a mipmapping issue as I create the textures the same way for a different renderer, which was working properly. I had a few problems that were contributing to the incorrect results. It looks like everything is working now.
Thanks!
I have some more questions.
Shouldn’t I be able to call glActiveTexture(0) and then glBindTexture(71)? Do the IDs have to match up for both function calls?
I thought that the active textures were limited to the max combined texture units. I also assumed that since openGL will generate image IDs above that limit that you could bind any texture in memory to an available active texture slot.
For instance if I had 96 max combined texture image units, if my graphics card supported it, I could have 96 active textures at once, but they could range from 1-N (however large an ID openGL will give you).
The active texture unit is nothing to with the bound texture ID.
Cas
Look,
gl4.glActiveTexture(GL_TEXTURE0 + textureUnit);
gl4.glBindTexture(GL_TEXTURE_2D, textureId);
glActiveTexture requires the texture unit, for example the textureUnit can be 0
glBindTexture requires the texture id you obtained when you called glGenTextures
Thanks Cas, that’s what I thought. For some reason it doesn’t seem to be working properly, I must have a bug else where.
Appreciate it all.
Edit: :emo: :emo: :emo: :emo: :emo: :emo: :emo: :emo:
The second problem was caused by me setting the uniform in the shader to the texture id, and not the unit it was bound to… :emo: :emo: :emo: :emo: :emo: :emo: