Updated source code to reflect content changes (code re-work): advanced OpenGL and model-loading.

This commit is contained in:
Joey de Vries
2017-05-31 23:12:15 +02:00
parent 70b789d3b9
commit 49d8d895ae
28 changed files with 116 additions and 71 deletions

View File

@@ -7,5 +7,5 @@ uniform mat4 projection;
void main()
{
gl_Position = projection * view * model * vec4(aPos, 1.0f);
gl_Position = projection * view * model * vec4(aPos, 1.0);
}

View File

@@ -45,13 +45,13 @@ int main()
// glfw window creation
// --------------------
GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL);
glfwMakeContextCurrent(window);
if (window == NULL)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwSetCursorPosCallback(window, mouse_callback);
glfwSetScrollCallback(window, scroll_callback);
@@ -234,7 +234,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)
@@ -254,7 +253,6 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
glViewport(0, 0, width, height);
}
// glfw: whenever the mouse moves, this callback is called
// -------------------------------------------------------
void mouse_callback(GLFWwindow* window, double xpos, double ypos)
@@ -284,7 +282,7 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
// utility function for loading a 2D texture from file
// ---------------------------------------------------
unsigned int loadTexture(char const * path)
unsigned int loadTexture(char const *path)
{
unsigned int textureID;
glGenTextures(1, &textureID);