My question is very similar to this one but the answers there did not help me.
I am trying to use the DSA approach to bind textures and it is not working.
Here is my attempt at the DSA code, which leads too all black in as my output:
GLuint samplerName;
glCreateSamplers(1, &samplerName);
glSamplerParameteri(samplerName, GL_TEXTURE_WRAP_S, GL_REPEAT);
glSamplerParameteri(samplerName, GL_TEXTURE_WRAP_T, GL_REPEAT);
glSamplerParameteri(samplerName, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glSamplerParameteri(samplerName, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindSampler(0, samplerName);
// Create texture
GLuint texture;
glCreateTextures(GL_TEXTURE_2D, 1, &texture);
glTextureStorage2D(texture, 1, GL_RGB, width, height);
glTextureSubImage2D(texture, 0, 0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, data);
glTextureParameteri(texture, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glBindTextureUnit(0, texture);
If I add these two lines from the older approach:
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
it works so I do not think it is an issue with my sampler or my data. Does anybody have any advice here?