浏览代码

missing ifdef for opengl

Former-commit-id: f65c0bfae2456074283fb6393f9e5b5a439a2f19
Daniele Panozzo 10 年之前
父节点
当前提交
a14c81e29f

+ 8 - 4
include/igl/compile_and_link_program.cpp

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "compile_and_link_program.h"
 #include "compile_shader.h"
@@ -11,6 +11,8 @@
 #include <iostream>
 #include <cassert>
 
+#ifndef IGL_NO_OPENGL
+
 IGL_INLINE GLuint igl::compile_and_link_program(
   const char * v_str, const char * f_str)
 {
@@ -38,3 +40,5 @@ IGL_INLINE GLuint igl::compile_and_link_program(
   }
   return prog_id;
 }
+
+#endif

+ 8 - 4
include/igl/compile_and_link_program.h

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_COMPILE_AND_LINK_PROGRAM_H
 #define IGL_COMPILE_AND_LINK_PROGRAM_H
@@ -11,6 +11,8 @@
 #include "OpenGL_convenience.h"
 namespace igl
 {
+  #ifndef IGL_NO_OPENGL
+
   // Compile and link very simple vertex/fragment shaders
   //
   // Inputs:
@@ -22,6 +24,8 @@ namespace igl
   // functionality.
   IGL_INLINE GLuint compile_and_link_program(
     const char * v_str, const char * f_str);
+
+  #endif
 }
 #ifndef IGL_STATIC_LIBRARY
 #  include "compile_and_link_program.cpp"

+ 8 - 4
include/igl/compile_shader.cpp

@@ -1,14 +1,16 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "compile_shader.h"
 #include "report_gl_error.h"
 #include <iostream>
 
+#ifndef IGL_NO_OPENGL
+
 IGL_INLINE GLuint igl::compile_shader(const GLint type, const char * str)
 {
   GLuint id = glCreateShader(type);
@@ -33,3 +35,5 @@ IGL_INLINE GLuint igl::compile_shader(const GLint type, const char * str)
   }
   return id;
 }
+
+#endif

+ 8 - 5
include/igl/compile_shader.h

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_COMPILE_SHADER_H
 #define IGL_COMPILE_SHADER_H
@@ -11,8 +11,9 @@
 #include "igl_inline.h"
 namespace igl
 {
+  #ifndef IGL_NO_OPENGL
   // Compile a shader given type and string of shader code
-  // 
+  //
   // Inputs:
   //   type  either GL_VERTEX_SHADER or GL_FRAGMENT_SHADER
   //   str  contents of shader code
@@ -28,6 +29,8 @@ namespace igl
   //
   // Known bugs: seems to be duplicate of `load_shader`
   IGL_INLINE GLuint compile_shader(const GLint type, const char * str);
+  #endif
+
 }
 #ifndef IGL_STATIC_LIBRARY
 #  include "compile_shader.cpp"

+ 9 - 4
include/igl/draw_rectangular_marquee.cpp

@@ -1,10 +1,13 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef IGL_NO_OPENGL
+
 #include "draw_rectangular_marquee.h"
 #include "OpenGL_convenience.h"
 #include "material_colors.h"
@@ -56,3 +59,5 @@ IGL_INLINE void igl::draw_rectangular_marquee(
   (s ? glEnable(GL_LINE_STIPPLE):glDisable(GL_LINE_STIPPLE));
   (l ? glEnable(GL_LIGHTING):glDisable(GL_LIGHTING));
 }
+
+#endif

+ 8 - 4
include/igl/draw_rectangular_marquee.h

@@ -1,15 +1,17 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_DRAW_RECTANGULAR_MARQUEE_H
 #define IGL_DRAW_RECTANGULAR_MARQUEE_H
 #include "igl_inline.h"
 namespace igl
 {
+  #ifndef IGL_NO_OPENGL
+
   // Draw a rectangular marquee (selection box) in screen space. This sets up
   // screen space using current viewport.
   //
@@ -23,6 +25,8 @@ namespace igl
     const int from_y,
     const int to_x,
     const int to_y);
+
+    #endif
 }
 
 #ifndef IGL_STATIC_LIBRARY

+ 17 - 7
include/igl/draw_skeleton_3d.cpp

@@ -1,10 +1,13 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef IGL_NO_OPENGL
+
 #include "draw_skeleton_3d.h"
 #include "PI.h"
 #include "OpenGL_convenience.h"
@@ -12,10 +15,11 @@
 #include <Eigen/Geometry>
 #include <iostream>
 
+
 template <
-  typename DerivedC, 
-  typename DerivedBE, 
-  typename DerivedT, 
+  typename DerivedC,
+  typename DerivedBE,
+  typename DerivedT,
   typename Derivedcolor>
 IGL_INLINE void igl::draw_skeleton_3d(
   const Eigen::PlainObjectBase<DerivedC> & C,
@@ -155,10 +159,16 @@ IGL_INLINE void igl::draw_skeleton_3d(
   return draw_skeleton_3d(C,BE,Eigen::MatrixXd(),MAYA_SEA_GREEN);
 }
 
+#endif
+
 #ifdef IGL_STATIC_LIBRARY
+#ifndef IGL_NO_OPENGL
+
 // Explicit template instanciation
 template void igl::draw_skeleton_3d<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
 template void igl::draw_skeleton_3d<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&);
 template void igl::draw_skeleton_3d<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<float, 4, 1, 0, 4, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, 4, 1, 0, 4, 1> > const&, double);
 template void igl::draw_skeleton_3d<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&, double);
+
+#endif
 #endif

+ 13 - 7
include/igl/draw_skeleton_3d.h

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_DRAW_SKELETON_3D_H
 #define IGL_DRAW_SKELETON_3D_H
@@ -12,6 +12,9 @@
 #include <Eigen/Core>
 namespace igl
 {
+
+  #ifndef IGL_NO_OPENGL
+
   // Draw a skeleton
   //
   // Inputs:
@@ -21,9 +24,9 @@ namespace igl
   //   color  #BE|1 by 4 list of color
   //   half_bbd  half bounding box diagonal to determine scaling {1.0}
   template <
-    typename DerivedC, 
-    typename DerivedBE, 
-    typename DerivedT, 
+    typename DerivedC,
+    typename DerivedBE,
+    typename DerivedT,
     typename Derivedcolor>
   IGL_INLINE void draw_skeleton_3d(
     const Eigen::PlainObjectBase<DerivedC> & C,
@@ -42,6 +45,9 @@ namespace igl
     const Eigen::PlainObjectBase<DerivedC> & C,
     const Eigen::PlainObjectBase<DerivedBE> & BE);
 };
+
+  #endif
+  
 #ifndef IGL_STATIC_LIBRARY
 #  include "draw_skeleton_3d.cpp"
 #endif

+ 12 - 5
include/igl/draw_skeleton_vector_graphics.cpp

@@ -1,15 +1,17 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "draw_skeleton_vector_graphics.h"
 #include "OpenGL_convenience.h"
 #include "draw_point.h"
 #include "material_colors.h"
 
+#ifndef IGL_NO_OPENGL
+
 IGL_INLINE void igl::draw_skeleton_vector_graphics(
   const Eigen::MatrixXd & C,
   const Eigen::MatrixXi & BE)
@@ -104,7 +106,7 @@ IGL_INLINE void igl::draw_skeleton_vector_graphics(
   BET.resize(BE.rows(),2);
   for(int e = 0;e<BE.rows();e++)
   {
-    BET(e,0) = 2*e; 
+    BET(e,0) = 2*e;
     BET(e,1) = 2*e+1;
     const auto & c0 = C.row(BE(e,0));
     const auto & c1 = C.row(BE(e,1));
@@ -116,7 +118,12 @@ IGL_INLINE void igl::draw_skeleton_vector_graphics(
   draw_skeleton_vector_graphics(CT,BET,point_color,line_color);
 }
 
+#endif
+
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template instanciation
+#ifndef IGL_NO_OPENGL
+
 template void igl::draw_skeleton_vector_graphics<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&);
 #endif
+#endif

+ 9 - 5
include/igl/draw_skeleton_vector_graphics.h

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_DRAW_SKELETON_VECTOR_GRAPHICS_H
 #define IGL_DRAW_SKELETON_VECTOR_GRAPHICS_H
@@ -12,6 +12,8 @@
 
 namespace igl
 {
+  #ifndef IGL_NO_OPENGL
+
   // Draw a skeleton with a 2D vector graphcis style à la BBW, STBS, Monotonic,
   // FAST papers.
   //
@@ -42,8 +44,10 @@ namespace igl
     const Eigen::PlainObjectBase<DerivedC> & C,
     const Eigen::PlainObjectBase<DerivedBE> & BE,
     const Eigen::PlainObjectBase<DerivedT> & T);
+
+    #endif
 }
 #ifndef IGL_STATIC_LIBRARY
 #  include "draw_skeleton_vector_graphics.cpp"
 #endif
-#endif 
+#endif

+ 7 - 4
include/igl/init_render_to_texture.cpp

@@ -1,13 +1,15 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "init_render_to_texture.h"
 #include <cassert>
 
+#ifndef IGL_NO_OPENGL
+
 IGL_INLINE void igl::init_render_to_texture(
   const size_t width,
   const size_t height,
@@ -51,3 +53,4 @@ IGL_INLINE void igl::init_render_to_texture(
   glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
 }
 
+#endif

+ 8 - 4
include/igl/init_render_to_texture.h

@@ -1,9 +1,9 @@
 // This file is part of libigl, a simple c++ geometry processing library.
-// 
+//
 // Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
-// 
-// This Source Code Form is subject to the terms of the Mozilla Public License 
-// v. 2.0. If a copy of the MPL was not distributed with this file, You can 
+//
+// This Source Code Form is subject to the terms of the Mozilla Public License
+// v. 2.0. If a copy of the MPL was not distributed with this file, You can
 // obtain one at http://mozilla.org/MPL/2.0/.
 #ifndef IGL_INIT_RENDER_TO_TEXTURE_H
 #define IGL_INIT_RENDER_TO_TEXTURE_H
@@ -12,6 +12,8 @@
 #include <cstdlib>
 namespace igl
 {
+  #ifndef IGL_NO_OPENGL
+
   // Create a texture+framebuffer+depthbuffer triplet bound for rendering into
   // the texture;
   //
@@ -28,6 +30,8 @@ namespace igl
     GLuint & tex_id,
     GLuint & fbo_id,
     GLuint & dfbo_id);
+
+  #endif
 }
 #ifndef IGL_STATIC_LIBRARY
 #  include "init_render_to_texture.cpp"

+ 0 - 1
tutorial/CMakeLists.shared

@@ -70,7 +70,6 @@ include_directories(
 
 link_directories(
 	/usr/local/lib
-	/opt/local/lib
 	${EIGEN_DIRS}
 )