Fix OSX errors and warnings

This commit is contained in:
Matthew Taylor
2017-06-18 00:39:07 +01:00
parent 30caeb3489
commit 120c8c8c11
5 changed files with 30 additions and 31 deletions

View File

@@ -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;
}
}