diff --git a/examples/movement/main.cpp b/examples/movement/main.cpp index c0479dd..0b3874f 100644 --- a/examples/movement/main.cpp +++ b/examples/movement/main.cpp @@ -11,7 +11,7 @@ bool escaped = false; double lastX = 0.0f; double lastY = 0.0f; -oglu::Camera camera; +oglu::Camera camera(45.0f, 16.f / 9.f, 0.01f, 100.0f); void framebuffer_size_callback(GLFWwindow* window, int width, int height) { @@ -31,8 +31,8 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) firstMouse = false; } - float xoffset = xpos - lastX; - float yoffset = lastY - ypos; + float xoffset = (float)xpos - (float)lastX; + float yoffset = (float)lastY - (float)ypos; lastX = xpos; lastY = ypos; @@ -42,12 +42,6 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos) camera.Pan(-xoffset); camera.Tilt(yoffset); - - //glm::vec3 direction; - //direction.x = cos(glm::radians(yaw)) * cos(glm::radians(pitch)); - //direction.y = sin(glm::radians(pitch)); - //direction.z = sin(glm::radians(yaw)) * cos(glm::radians(pitch)); - //cameraFront = glm::normalize(direction); } void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) @@ -90,10 +84,11 @@ int main(int argc, char** argv) glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); const GLFWvidmode* screen = glfwGetVideoMode(glfwGetPrimaryMonitor()); - int windowSize = screen->height / 4 * 3; + int windowHeight = screen->height / 5 * 4; + int windowWidth = (int)(16.f / 9.f * windowHeight); // Create Window - GLFWwindow* window = glfwCreateWindow(windowSize, windowSize, "First Person Movement Test", NULL, NULL); + GLFWwindow* window = glfwCreateWindow(windowWidth, windowHeight, "First Person Movement Test", NULL, NULL); if (window == nullptr) { std::cerr << "Failed to create GLFW window" << std::endl; @@ -107,7 +102,7 @@ int main(int argc, char** argv) // glad stuff oglu::LoadGLLoader((GLADloadproc)glfwGetProcAddress); - oglu::SetViewport(0, 0, windowSize, windowSize); + oglu::SetViewport(0, 0, windowWidth, windowHeight); // Create vertices for square float vertices[] = { diff --git a/include/core.hpp b/include/core.hpp index c7f2f4a..36ff75e 100644 --- a/include/core.hpp +++ b/include/core.hpp @@ -9,6 +9,8 @@ #ifndef CORE_HPP #define CORE_HPP +#pragma warning(disable : 4251) + #include #include #include diff --git a/src/vertexArray.cpp b/src/vertexArray.cpp index 82bd639..7b56be9 100644 --- a/src/vertexArray.cpp +++ b/src/vertexArray.cpp @@ -28,6 +28,7 @@ namespace oglu std::shared_ptr MakeVertexArray(const char* filepath) { + // This sucks std::ifstream file(filepath); if (!file.good()) { @@ -102,7 +103,7 @@ namespace oglu glBindVertexArray(0); - count = indicesSize / sizeof(GLuint); + count = (GLsizei)(indicesSize / sizeof(GLuint)); } void AbstractVertexArray::Bind()