Rename all occurences of 'Lamp' in Lighting chapter to 'LightCube' (VAO and Shaders).

This commit is contained in:
Joey de Vries
2020-05-19 17:43:15 +02:00
parent 0a65422760
commit f9cae3f84f
39 changed files with 130 additions and 130 deletions

View File

@@ -78,7 +78,7 @@ int main()
// build and compile our shader zprogram
// ------------------------------------
Shader lightingShader("3.1.materials.vs", "3.1.materials.fs");
Shader lampShader("3.1.lamp.vs", "3.1.lamp.fs");
Shader lightCubeShader("3.1.light_cube.vs", "3.1.light_cube.fs");
// set up vertex data (and buffer(s)) and configure vertex attributes
// ------------------------------------------------------------------
@@ -144,9 +144,9 @@ int main()
// second, configure the light's VAO (VBO stays the same; the vertices are the same for the light object which is also a 3D cube)
unsigned int lightVAO;
glGenVertexArrays(1, &lightVAO);
glBindVertexArray(lightVAO);
unsigned int lightCubeVAO;
glGenVertexArrays(1, &lightCubeVAO);
glBindVertexArray(lightCubeVAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
// note that we update the lamp's position attribute's stride to reflect the updated buffer data
@@ -211,15 +211,15 @@ int main()
// also draw the lamp object
lampShader.use();
lampShader.setMat4("projection", projection);
lampShader.setMat4("view", view);
lightCubeShader.use();
lightCubeShader.setMat4("projection", projection);
lightCubeShader.setMat4("view", view);
model = glm::mat4(1.0f);
model = glm::translate(model, lightPos);
model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
lampShader.setMat4("model", model);
lightCubeShader.setMat4("model", model);
glBindVertexArray(lightVAO);
glBindVertexArray(lightCubeVAO);
glDrawArrays(GL_TRIANGLES, 0, 36);
@@ -232,7 +232,7 @@ int main()
// optional: de-allocate all resources once they've outlived their purpose:
// ------------------------------------------------------------------------
glDeleteVertexArrays(1, &cubeVAO);
glDeleteVertexArrays(1, &lightVAO);
glDeleteVertexArrays(1, &lightCubeVAO);
glDeleteBuffers(1, &VBO);
// glfw: terminate, clearing all previously allocated GLFW resources.