From c5f7eff19019eb7e44704277924d554831ba47d4 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 27 Sep 2012 02:35:19 +0200 Subject: [PATCH 1/4] Fixed use of functions missing on VC++. --- src/gamma.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gamma.c b/src/gamma.c index eed0b66d..51e0ce14 100644 --- a/src/gamma.c +++ b/src/gamma.c @@ -67,8 +67,12 @@ GLFWAPI void glfwSetGamma(float gamma) value = (float) i / (float) (size - 1); // Apply gamma curve value = (float) pow(value, 1.f / gamma) * 65535.f + 0.5f; + // Clamp to value range - value = (float) fmax(fmin(value, 65535.f), 0.f); + if (value < 0.f) + value = 0.f; + else if (value > 65535.f) + value = 65535.f; ramp.red[i] = (unsigned short) value; ramp.green[i] = (unsigned short) value; From 7fa27f1e98b07bd5b837478f3c8333bfc98a1ecf Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 27 Sep 2012 02:49:20 +0200 Subject: [PATCH 2/4] Fixed warnings on VC++. --- src/CMakeLists.txt | 4 ++++ tests/threads.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8a7bdec3..5d066b70 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,10 @@ include_directories(${GLFW_SOURCE_DIR}/src ${GLFW_BINARY_DIR}/src ${glfw_INCLUDE_DIRS}) +if (MSVC) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) +endif() + set(common_HEADERS ${GLFW_SOURCE_DIR}/include/GL/glfw3.h internal.h) set(common_SOURCES clipboard.c fullscreen.c gamma.c init.c input.c joystick.c opengl.c time.c window.c) diff --git a/tests/threads.c b/tests/threads.c index 35c83716..49e3739a 100644 --- a/tests/threads.c +++ b/tests/threads.c @@ -28,6 +28,8 @@ // //======================================================================== +#include "tinycthread.h" + #include #include @@ -35,8 +37,6 @@ #include #include -#include "tinycthread.h" - typedef struct { GLFWwindow window; From fe0cc512a29ae389630954eadd70dc5ce235d95d Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 27 Sep 2012 15:18:57 +0200 Subject: [PATCH 3/4] Added missing cast. --- src/window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/window.c b/src/window.c index e9da2367..901d9a77 100644 --- a/src/window.c +++ b/src/window.c @@ -268,7 +268,7 @@ GLFWAPI GLFWwindow glfwCreateWindow(int width, int height, wndconfig.glDebug = _glfwLibrary.hints.glDebug ? GL_TRUE : GL_FALSE; wndconfig.glProfile = _glfwLibrary.hints.glProfile; wndconfig.glRobustness = _glfwLibrary.hints.glRobustness ? GL_TRUE : GL_FALSE; - wndconfig.share = share; + wndconfig.share = (_GLFWwindow*) share; // Reset to default values for the next call _glfwSetDefaultWindowHints(); From 410a4e29e133fe911c817fb1061df16420c4365a Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Thu, 27 Sep 2012 22:28:04 +0200 Subject: [PATCH 4/4] Moved from gl3.h to glcorearb.h. --- include/GL/glfw3.h | 6 +++--- readme.html | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index dae1cc6a..3ef25d16 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -141,7 +141,7 @@ extern "C" { /* Include the chosen OpenGL header and, optionally, the GLU header. */ #if defined(__APPLE_CC__) - #if defined(GLFW_INCLUDE_GL3) + #if defined(GLFW_INCLUDE_GLCOREARB) #include #else #define GL_GLEXT_LEGACY @@ -151,8 +151,8 @@ extern "C" { #include #endif #else - #if defined(GLFW_INCLUDE_GL3) - #include + #if defined(GLFW_INCLUDE_GLCOREARB) + #include #else #include #endif diff --git a/readme.html b/readme.html index c6047bb7..633c775e 100644 --- a/readme.html +++ b/readme.html @@ -282,7 +282,7 @@ version of GLFW.

  • Added GLFW_OPENGL_ES2_PROFILE profile for creating OpenGL ES 2.0 contexts using the GLX_EXT_create_context_es2_profile and WGL_EXT_create_context_es2_profile extensions
  • Added GLFW_OPENGL_ROBUSTNESS window hint and associated strategy tokens for GL_ARB_robustness support
  • Added GLFW_OPENGL_REVISION window parameter to make up for removal of glfwGetGLVersion
  • -
  • Added GLFW_INCLUDE_GL3 macro for telling the GLFW header to include gl3.h header instead of gl.h
  • +
  • Added GLFW_INCLUDE_GLCOREARB macro for including glcorearb.h instead of gl.h
  • Added GLFW_VISIBLE window hint and parameter for controlling and polling window visibility
  • Added windows simple multi-window test program
  • Added sharing simple OpenGL object sharing test program