From b5848894eb4036511de5620a4ac4c06838a28e79 Mon Sep 17 00:00:00 2001 From: Shivpratap Chauhan Date: Wed, 12 Jul 2017 21:33:07 +0530 Subject: [PATCH] Add glfw hint for GLFW_OPENGL_FORWARD_COMPAT for more samples to let it work on osx --- .../light_casters_directional.cpp | 6 +++++- .../5.2.light_casters_point/light_casters_point.cpp | 6 +++++- .../5.3.light_casters_spot/light_casters_spot.cpp | 6 +++++- .../5.4.light_casters_spot_soft/light_casters_spot_soft.cpp | 6 +++++- src/2.lighting/6.multiple_lights/multiple_lights.cpp | 6 +++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp b/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp index f465042..cd823c0 100644 --- a/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp +++ b/src/2.lighting/5.1.light_casters_directional/light_casters_directional.cpp @@ -41,6 +41,10 @@ int main() glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); +#ifdef __APPLE__ + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); +#endif + // glfw window creation // -------------------- GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL); @@ -362,4 +366,4 @@ unsigned int loadTexture(char const * path) } return textureID; -} \ No newline at end of file +} diff --git a/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp b/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp index b5b1e9b..bf5c55f 100644 --- a/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp +++ b/src/2.lighting/5.2.light_casters_point/light_casters_point.cpp @@ -44,6 +44,10 @@ int main() glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); +#ifdef __APPLE__ + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); +#endif + // glfw window creation // -------------------- GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL); @@ -363,4 +367,4 @@ unsigned int loadTexture(char const * path) } return textureID; -} \ No newline at end of file +} diff --git a/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp b/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp index fa6d76c..a10cd33 100644 --- a/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp +++ b/src/2.lighting/5.3.light_casters_spot/light_casters_spot.cpp @@ -41,6 +41,10 @@ int main() glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); +#ifdef __APPLE__ + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); +#endif + // glfw window creation // -------------------- GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL); @@ -364,4 +368,4 @@ unsigned int loadTexture(char const * path) } return textureID; -} \ No newline at end of file +} diff --git a/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp b/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp index ced5392..c939e7d 100644 --- a/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp +++ b/src/2.lighting/5.4.light_casters_spot_soft/light_casters_spot_soft.cpp @@ -41,6 +41,10 @@ int main() glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); +#ifdef __APPLE__ + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); +#endif + // glfw window creation // -------------------- GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL); @@ -364,4 +368,4 @@ unsigned int loadTexture(char const * path) } return textureID; -} \ No newline at end of file +} diff --git a/src/2.lighting/6.multiple_lights/multiple_lights.cpp b/src/2.lighting/6.multiple_lights/multiple_lights.cpp index 22f5abe..9f319d8 100644 --- a/src/2.lighting/6.multiple_lights/multiple_lights.cpp +++ b/src/2.lighting/6.multiple_lights/multiple_lights.cpp @@ -44,6 +44,10 @@ int main() glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); +#ifdef __APPLE__ + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); +#endif + // glfw window creation // -------------------- GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL); @@ -417,4 +421,4 @@ unsigned int loadTexture(char const * path) } return textureID; -} \ No newline at end of file +}