1
0
mirror of https://github.com/LearnOpenGL-CN/LearnOpenGL-CN.git synced 2025-08-23 04:35:28 +08:00

merge pull request #169 from B1ACK917/new-theme

修改了一处翻译错误,评论区很多人指出
This commit is contained in:
K
2020-09-12 08:21:18 -04:00
committed by GitHub

View File

@@ -368,7 +368,7 @@ glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
我们还要通过使用<fun>glUniform1i</fun>设置每个采样器的方式告诉OpenGL每个着色器采样器属于哪个纹理单元。我们只需要设置一次即可所以这个会放在渲染循环的前面
```c++
ourShader.use(); // 忘记在激活着色器前先设置uniform
ourShader.use(); // 不要忘记在设置uniform变量之前激活着色器程序
glUniform1i(glGetUniformLocation(ourShader.ID, "texture1"), 0); // 手动设置
ourShader.setInt("texture2", 1); // 或者使用着色器类设置