mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
fixed compiler warnings reported by gcc/clang
* changed some catch blocks to use exception references instead of value types * fixed missing use of SCR_WIDTH/SCR_HEIGHT for glfwCreateWindow * fixed implicit numeric type casts regarding signedness * removed unused variables Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
This commit is contained in:
@@ -191,7 +191,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)
|
||||
@@ -278,11 +277,11 @@ void renderSphere()
|
||||
}
|
||||
|
||||
bool oddRow = false;
|
||||
for (int y = 0; y < Y_SEGMENTS; ++y)
|
||||
for (unsigned int y = 0; y < Y_SEGMENTS; ++y)
|
||||
{
|
||||
if (!oddRow) // even rows: y == 0, y == 2; and so on
|
||||
{
|
||||
for (int x = 0; x <= X_SEGMENTS; ++x)
|
||||
for (unsigned int x = 0; x <= X_SEGMENTS; ++x)
|
||||
{
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
@@ -290,7 +289,7 @@ void renderSphere()
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = X_SEGMENTS; x >= 0; --x)
|
||||
for (unsigned int x = X_SEGMENTS; x >= 0; --x)
|
||||
{
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
@@ -301,7 +300,7 @@ void renderSphere()
|
||||
indexCount = indices.size();
|
||||
|
||||
std::vector<float> data;
|
||||
for (int i = 0; i < positions.size(); ++i)
|
||||
for (unsigned int i = 0; i < positions.size(); ++i)
|
||||
{
|
||||
data.push_back(positions[i].x);
|
||||
data.push_back(positions[i].y);
|
||||
|
||||
@@ -202,7 +202,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)
|
||||
@@ -289,11 +288,11 @@ void renderSphere()
|
||||
}
|
||||
|
||||
bool oddRow = false;
|
||||
for (int y = 0; y < Y_SEGMENTS; ++y)
|
||||
for (unsigned int y = 0; y < Y_SEGMENTS; ++y)
|
||||
{
|
||||
if (!oddRow) // even rows: y == 0, y == 2; and so on
|
||||
{
|
||||
for (int x = 0; x <= X_SEGMENTS; ++x)
|
||||
for (unsigned int x = 0; x <= X_SEGMENTS; ++x)
|
||||
{
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
@@ -301,7 +300,7 @@ void renderSphere()
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = X_SEGMENTS; x >= 0; --x)
|
||||
for (unsigned int x = X_SEGMENTS; x >= 0; --x)
|
||||
{
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
@@ -312,7 +311,7 @@ void renderSphere()
|
||||
indexCount = indices.size();
|
||||
|
||||
std::vector<float> data;
|
||||
for (int i = 0; i < positions.size(); ++i)
|
||||
for (std::size_t i = 0; i < positions.size(); ++i)
|
||||
{
|
||||
data.push_back(positions[i].x);
|
||||
data.push_back(positions[i].y);
|
||||
|
||||
@@ -307,7 +307,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)
|
||||
@@ -394,11 +393,11 @@ void renderSphere()
|
||||
}
|
||||
|
||||
bool oddRow = false;
|
||||
for (int y = 0; y < Y_SEGMENTS; ++y)
|
||||
for (unsigned int y = 0; y < Y_SEGMENTS; ++y)
|
||||
{
|
||||
if (!oddRow) // even rows: y == 0, y == 2; and so on
|
||||
{
|
||||
for (int x = 0; x <= X_SEGMENTS; ++x)
|
||||
for (unsigned int x = 0; x <= X_SEGMENTS; ++x)
|
||||
{
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
@@ -406,7 +405,7 @@ void renderSphere()
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = X_SEGMENTS; x >= 0; --x)
|
||||
for (unsigned int x = X_SEGMENTS; x >= 0; --x)
|
||||
{
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
@@ -417,7 +416,7 @@ void renderSphere()
|
||||
indexCount = indices.size();
|
||||
|
||||
std::vector<float> data;
|
||||
for (int i = 0; i < positions.size(); ++i)
|
||||
for (unsigned int i = 0; i < positions.size(); ++i)
|
||||
{
|
||||
data.push_back(positions[i].x);
|
||||
data.push_back(positions[i].y);
|
||||
|
||||
@@ -347,7 +347,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)
|
||||
@@ -434,11 +433,11 @@ void renderSphere()
|
||||
}
|
||||
|
||||
bool oddRow = false;
|
||||
for (int y = 0; y < Y_SEGMENTS; ++y)
|
||||
for (unsigned int y = 0; y < Y_SEGMENTS; ++y)
|
||||
{
|
||||
if (!oddRow) // even rows: y == 0, y == 2; and so on
|
||||
{
|
||||
for (int x = 0; x <= X_SEGMENTS; ++x)
|
||||
for (unsigned int x = 0; x <= X_SEGMENTS; ++x)
|
||||
{
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
@@ -446,7 +445,7 @@ void renderSphere()
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = X_SEGMENTS; x >= 0; --x)
|
||||
for (unsigned int x = X_SEGMENTS; x >= 0; --x)
|
||||
{
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
@@ -457,7 +456,7 @@ void renderSphere()
|
||||
indexCount = indices.size();
|
||||
|
||||
std::vector<float> data;
|
||||
for (int i = 0; i < positions.size(); ++i)
|
||||
for (std::size_t i = 0; i < positions.size(); ++i)
|
||||
{
|
||||
data.push_back(positions[i].x);
|
||||
data.push_back(positions[i].y);
|
||||
|
||||
@@ -445,7 +445,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)
|
||||
@@ -532,11 +531,11 @@ void renderSphere()
|
||||
}
|
||||
|
||||
bool oddRow = false;
|
||||
for (int y = 0; y < Y_SEGMENTS; ++y)
|
||||
for (unsigned int y = 0; y < Y_SEGMENTS; ++y)
|
||||
{
|
||||
if (!oddRow) // even rows: y == 0, y == 2; and so on
|
||||
{
|
||||
for (int x = 0; x <= X_SEGMENTS; ++x)
|
||||
for (unsigned int x = 0; x <= X_SEGMENTS; ++x)
|
||||
{
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
@@ -544,7 +543,7 @@ void renderSphere()
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = X_SEGMENTS; x >= 0; --x)
|
||||
for (unsigned int x = X_SEGMENTS; x >= 0; --x)
|
||||
{
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
@@ -555,7 +554,7 @@ void renderSphere()
|
||||
indexCount = indices.size();
|
||||
|
||||
std::vector<float> data;
|
||||
for (int i = 0; i < positions.size(); ++i)
|
||||
for (std::size_t i = 0; i < positions.size(); ++i)
|
||||
{
|
||||
data.push_back(positions[i].x);
|
||||
data.push_back(positions[i].y);
|
||||
|
||||
@@ -156,9 +156,6 @@ int main()
|
||||
glm::vec3(300.0f, 300.0f, 300.0f),
|
||||
glm::vec3(300.0f, 300.0f, 300.0f)
|
||||
};
|
||||
int nrRows = 7;
|
||||
int nrColumns = 7;
|
||||
float spacing = 2.5;
|
||||
|
||||
// pbr: setup framebuffer
|
||||
// ----------------------
|
||||
@@ -548,7 +545,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)
|
||||
@@ -635,11 +631,11 @@ void renderSphere()
|
||||
}
|
||||
|
||||
bool oddRow = false;
|
||||
for (int y = 0; y < Y_SEGMENTS; ++y)
|
||||
for (unsigned int y = 0; y < Y_SEGMENTS; ++y)
|
||||
{
|
||||
if (!oddRow) // even rows: y == 0, y == 2; and so on
|
||||
{
|
||||
for (int x = 0; x <= X_SEGMENTS; ++x)
|
||||
for (unsigned int x = 0; x <= X_SEGMENTS; ++x)
|
||||
{
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
@@ -647,7 +643,7 @@ void renderSphere()
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = X_SEGMENTS; x >= 0; --x)
|
||||
for (unsigned int x = X_SEGMENTS; x >= 0; --x)
|
||||
{
|
||||
indices.push_back((y + 1) * (X_SEGMENTS + 1) + x);
|
||||
indices.push_back(y * (X_SEGMENTS + 1) + x);
|
||||
@@ -658,7 +654,7 @@ void renderSphere()
|
||||
indexCount = indices.size();
|
||||
|
||||
std::vector<float> data;
|
||||
for (int i = 0; i < positions.size(); ++i)
|
||||
for (unsigned int i = 0; i < positions.size(); ++i)
|
||||
{
|
||||
data.push_back(positions[i].x);
|
||||
data.push_back(positions[i].y);
|
||||
|
||||
Reference in New Issue
Block a user