mirror of
https://github.com/LearnOpenGL-CN/LearnOpenGL-CN.git
synced 2025-08-22 20:25:28 +08:00
Update 02 Mesh.md
纹理编号是整型, 应该调用setInt
This commit is contained in:
@@ -170,7 +170,7 @@ void Draw(Shader shader)
|
|||||||
else if(name == "texture_specular")
|
else if(name == "texture_specular")
|
||||||
number = std::to_string(specularNr++);
|
number = std::to_string(specularNr++);
|
||||||
|
|
||||||
shader.setFloat(("material." + name + number).c_str(), i);
|
shader.setInt(("material." + name + number).c_str(), i);
|
||||||
glBindTexture(GL_TEXTURE_2D, textures[i].id);
|
glBindTexture(GL_TEXTURE_2D, textures[i].id);
|
||||||
}
|
}
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
@@ -190,4 +190,4 @@ void Draw(Shader shader)
|
|||||||
|
|
||||||
你可以在[这里](https://learnopengl.com/code_viewer_gh.php?code=includes/learnopengl/mesh.h)找到<fun>Mesh</fun>类的完整源代码
|
你可以在[这里](https://learnopengl.com/code_viewer_gh.php?code=includes/learnopengl/mesh.h)找到<fun>Mesh</fun>类的完整源代码
|
||||||
|
|
||||||
我们刚定义的<fun>Mesh</fun>类是我们之前讨论的很多话题的抽象结果。在[下一节](03 Model.md)中,我们将创建一个模型,作为多个网格对象的容器,并真正地实现Assimp的加载接口。
|
我们刚定义的<fun>Mesh</fun>类是我们之前讨论的很多话题的抽象结果。在[下一节](03 Model.md)中,我们将创建一个模型,作为多个网格对象的容器,并真正地实现Assimp的加载接口。
|
||||||
|
Reference in New Issue
Block a user