mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Fix OSX errors and warnings
This commit is contained in:
@@ -22,7 +22,7 @@ unsigned int loadTexture(const char *path, bool gammaCorrection);
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 1280;
|
||||
const unsigned int SCR_HEIGHT = 720;
|
||||
bool gamma = false;
|
||||
bool gammaEnabled = false;
|
||||
bool gammaKeyPressed = false;
|
||||
|
||||
// camera
|
||||
@@ -160,14 +160,14 @@ int main()
|
||||
glUniform3fv(glGetUniformLocation(shader.ID, "lightPositions"), 4, &lightPositions[0][0]);
|
||||
glUniform3fv(glGetUniformLocation(shader.ID, "lightColors"), 4, &lightColors[0][0]);
|
||||
shader.setVec3("viewPos", camera.Position);
|
||||
shader.setInt("gamma", gamma);
|
||||
shader.setInt("gamma", gammaEnabled);
|
||||
// floor
|
||||
glBindVertexArray(planeVAO);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, gamma ? floorTextureGammaCorrected : floorTexture);
|
||||
glBindTexture(GL_TEXTURE_2D, gammaEnabled ? floorTextureGammaCorrected : floorTexture);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
|
||||
std::cout << (gamma ? "Gamma enabled" : "Gamma disabled") << std::endl;
|
||||
std::cout << (gammaEnabled ? "Gamma enabled" : "Gamma disabled") << std::endl;
|
||||
|
||||
// glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
|
||||
// -------------------------------------------------------------------------------
|
||||
@@ -202,7 +202,7 @@ void processInput(GLFWwindow *window)
|
||||
|
||||
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_PRESS && !gammaKeyPressed)
|
||||
{
|
||||
gamma = !gamma;
|
||||
gammaEnabled = !gammaEnabled;
|
||||
gammaKeyPressed = true;
|
||||
}
|
||||
if (glfwGetKey(window, GLFW_KEY_SPACE) == GLFW_RELEASE)
|
||||
@@ -293,4 +293,4 @@ unsigned int loadTexture(char const * path, bool gammaCorrection)
|
||||
}
|
||||
|
||||
return textureID;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user