소스 검색

need to init glew on linux

Former-commit-id: 41e3b7736c700e32b1206d4c7f6c44fe29ad203c
Alec Jacobson 8 년 전
부모
커밋
a081fa6afa
1개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 10 0
      include/igl/opengl/glfw/background_window.cpp

+ 10 - 0
include/igl/opengl/glfw/background_window.cpp

@@ -17,6 +17,16 @@ IGL_INLINE bool igl::opengl::glfw::background_window(GLFWwindow* & window)
   window = glfwCreateWindow(1, 1,"", NULL, NULL);
   if(!window) return false;
   glfwMakeContextCurrent(window);
+  #ifndef __APPLE__
+    glewExperimental = true;
+    GLenum err = glewInit();
+    if(GLEW_OK != err)
+    {
+      /* Problem: glewInit failed, something is seriously wrong. */
+     fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
+    }
+    glGetError(); // pull and savely ignonre unhandled errors like GL_INVALID_ENUM
+  #endif
   return true;
 }