OpenGL GLSL Binding Sampler for Fragment Shader

不想你离开。 提交于 2019-12-02 06:34:10

There's indeed a problem with how you set the uniform value for the sampler:

gSampler = glGetUniformLocation(mProgramID, "gSampler");
glUniform1i(gSampler, GL_TEXTURE0);

The value you need to set for the uniform is the index of the texture unit, not the corresponding enum value. Since you are using texture unit 0 in this case, you need to replace the glUniform1i() call by:

glUniform1i(gSampler, 0);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!