mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Code re-work and content update: lighting.
This commit is contained in:
@@ -169,11 +169,11 @@ int main()
|
||||
transform = glm::rotate(transform, (float)glfwGetTime(), glm::vec3(0.0f, 0.0f, 1.0f));
|
||||
|
||||
// get matrix's uniform location and set matrix
|
||||
ourShader.use();
|
||||
unsigned int transformLoc = glGetUniformLocation(ourShader.ID, "transform");
|
||||
glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(transform));
|
||||
|
||||
// render container
|
||||
ourShader.use();
|
||||
glBindVertexArray(VAO);
|
||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ const unsigned int SCR_HEIGHT = 600;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
float lastX = 800.0f / 2.0;
|
||||
float lastY = 600.0 / 2.0;
|
||||
float lastX = SCR_WIDTH / 2.0f;
|
||||
float lastY = SCR_HEIGHT / 2.0f;
|
||||
bool firstMouse = true;
|
||||
|
||||
// timing
|
||||
@@ -281,7 +281,6 @@ void processInput(GLFWwindow *window)
|
||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
|
||||
glfwSetWindowShouldClose(window, true);
|
||||
|
||||
float cameraSpeed = 2.5 * deltaTime;
|
||||
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
|
||||
camera.ProcessKeyboard(FORWARD, deltaTime);
|
||||
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
|
||||
|
||||
Reference in New Issue
Block a user