GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; assert(monitor != NULL); assert(ramp != NULL); assert(ramp->size > 0); assert(ramp->red != NULL); assert(ramp->green != NULL); assert(ramp->blue != NULL); if (ramp->size <= 0) { _glfwInputError(GLFW_INVALID_VALUE, "Invalid gamma ramp size %i", ramp->size); return; } _GLFW_REQUIRE_INIT(); if (!monitor->originalRamp.size) _glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp); _glfwPlatformSetGammaRamp(monitor, ramp); }
int _glfwPlatformInit(void) { // To make SetForegroundWindow work as we want, we need to fiddle // with the FOREGROUNDLOCKTIMEOUT system setting (we do this as early // as possible in the hope of still being the foreground process) SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, &_glfw.win32.foregroundLockTimeout, 0); SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, UIntToPtr(0), SPIF_SENDCHANGE); if (!initLibraries()) return GL_FALSE; #ifdef __BORLANDC__ // With the Borland C++ compiler, we want to disable FPU exceptions // (this is recommended for OpenGL applications under Windows) _control87(MCW_EM, MCW_EM); #endif _glfw.win32.instance = GetModuleHandle(NULL); // Save the original gamma ramp _glfw.originalRampSize = 256; _glfwPlatformGetGammaRamp(&_glfw.originalRamp); _glfw.currentRamp = _glfw.originalRamp; if (!_glfwInitOpenGL()) return GL_FALSE; _glfwInitTimer(); _glfwInitJoysticks(); return GL_TRUE; }
GLFWAPI void glfwSetGammaRamp(GLFWmonitor* handle, const GLFWgammaramp* ramp) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; _GLFW_REQUIRE_INIT(); if (!monitor->originalRamp.size) _glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp); _glfwPlatformSetGammaRamp(monitor, ramp); }
GLFWAPI const GLFWgammaramp* glfwGetGammaRamp(GLFWmonitor* handle) { _GLFWmonitor* monitor = (_GLFWmonitor*) handle; _GLFW_REQUIRE_INIT_OR_RETURN(NULL); _glfwFreeGammaArrays(&monitor->currentRamp); _glfwPlatformGetGammaRamp(monitor, &monitor->currentRamp); return &monitor->currentRamp; }