mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
fix narrowing conversions (eg double to float, size_t to GLsizei)
This commit is contained in:
@@ -23,7 +23,7 @@ void renderQuad();
|
||||
// settings
|
||||
const unsigned int SCR_WIDTH = 800;
|
||||
const unsigned int SCR_HEIGHT = 600;
|
||||
float heightScale = 0.1;
|
||||
float heightScale = 0.1f;
|
||||
|
||||
// camera
|
||||
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
|
||||
@@ -107,7 +107,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
float currentFrame = glfwGetTime();
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -298,8 +298,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
|
||||
// glfw: whenever the mouse moves, this callback is called
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xpos, double ypos)
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -320,7 +322,7 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(yoffset);
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
Reference in New Issue
Block a user