Browse Source

Merge branch 'master' of https://github.com/libigl/libigl

Conflicts:
	include/igl/project.cpp
	include/igl/slice.cpp

+ integrable tutorial text


Former-commit-id: d3a6db8e55aafd00c3e13d37c0b66c0c74d1322f
Olga Diamanti 10 years ago
parent
commit
101530fe17
100 changed files with 719 additions and 1261 deletions
  1. 2 0
      .gitignore
  2. 2 0
      .gitmodules
  3. 1 0
      RELEASE_HISTORY.md
  4. 1 1
      VERSION.txt
  5. 3 3
      examples/Makefile.conf
  6. 8 8
      examples/ambient-occlusion/example.cpp
  7. 0 1
      examples/arap/Makefile
  8. 7 7
      examples/arap/example.cpp
  9. 16 16
      examples/beach-balls/BeachBall.cpp
  10. 2 2
      examples/beach-balls/example.cpp
  11. 8 8
      examples/camera/example.cpp
  12. 7 7
      examples/colored-mesh/example.cpp
  13. 1 1
      examples/components/Makefile
  14. 16 16
      examples/components/example.cpp
  15. 19 19
      examples/embree/example.cpp
  16. 16 16
      examples/flare-eyes/example.cpp
  17. 8 8
      examples/intersections/example.cpp
  18. 16 16
      examples/multi-viewport/example.cpp
  19. 1 1
      examples/patches/Makefile
  20. 8 8
      examples/patches/example.cpp
  21. 6 6
      examples/randomly-sample-mesh/example.cpp
  22. 8 8
      examples/rotate-widget/example.cpp
  23. 6 6
      examples/scene-rotation/example.cpp
  24. 1 1
      examples/scene-rotation/trackball.cpp
  25. 6 6
      examples/shadow-mapping/example.cpp
  26. 39 27
      examples/skeleton-builder/example.cpp
  27. 15 14
      examples/skeleton-poser/example.cpp
  28. 10 10
      examples/skeleton/example.cpp
  29. 7 8
      examples/textured-mesh/example.cpp
  30. 1 1
      examples/transparency/Makefile
  31. 12 12
      examples/transparency/example.cpp
  32. 5 5
      examples/upright/example.cpp
  33. 2 2
      google-soc/index.html
  34. 0 1
      include/igl/AABB.h
  35. 1 1
      include/igl/ARAPEnergyType.h
  36. 4 2
      include/igl/arap.cpp
  37. 3 0
      include/igl/arap.h
  38. 43 9
      include/igl/biharmonic_coordinates.cpp
  39. 13 0
      include/igl/biharmonic_coordinates.h
  40. 2 4
      include/igl/boolean/mesh_boolean.cpp
  41. 1 1
      include/igl/bounding_box_diagonal.cpp
  42. 3 1
      include/igl/cat.cpp
  43. 1 1
      include/igl/cgal/mesh_to_polyhedron.cpp
  44. 1 1
      include/igl/cgal/peel_outer_hull_layers.cpp
  45. 1 1
      include/igl/cgal/polyhedron_to_mesh.cpp
  46. 1 0
      include/igl/colon.cpp
  47. 1 1
      include/igl/comiso/miq.cpp.REMOVED.git-id
  48. 0 33
      include/igl/compile_and_link_program.h
  49. 0 38
      include/igl/compile_shader.h
  50. 1 0
      include/igl/components.cpp
  51. 0 63
      include/igl/create_mesh_vbo.h
  52. 0 65
      include/igl/create_shader_program.h
  53. 0 35
      include/igl/destroy_shader_program.h
  54. 1 1
      include/igl/directed_edge_orientations.cpp
  55. 1 1
      include/igl/directed_edge_parents.cpp
  56. 1 1
      include/igl/dqs.cpp
  57. 0 58
      include/igl/draw_floor.h
  58. 0 121
      include/igl/draw_mesh.h
  59. 0 45
      include/igl/draw_point.h
  60. 0 36
      include/igl/draw_rectangular_marquee.h
  61. 0 54
      include/igl/draw_skeleton_3d.h
  62. 0 53
      include/igl/draw_skeleton_vector_graphics.h
  63. 5 0
      include/igl/eigs.cpp
  64. 3 0
      include/igl/eigs.h
  65. 7 2
      include/igl/embree/EmbreeIntersector.h
  66. 1 1
      include/igl/embree/ambient_occlusion.cpp
  67. 1 1
      include/igl/embree/bone_visible.cpp
  68. 15 62
      include/igl/embree/unproject_in_mesh.cpp
  69. 30 42
      include/igl/embree/unproject_in_mesh.h
  70. 1 1
      include/igl/embree/unproject_onto_mesh.cpp
  71. 1 1
      include/igl/fit_rotations.cpp
  72. 3 0
      include/igl/fit_rotations.h
  73. 0 1
      include/igl/flare_textures.h.REMOVED.git-id
  74. 1 1
      include/igl/forward_kinematics.cpp
  75. 1 1
      include/igl/group_sum_matrix.cpp
  76. 1 1
      include/igl/harmonic.cpp
  77. 0 39
      include/igl/init_render_to_texture.h
  78. 0 92
      include/igl/lens_flare.h
  79. 1 1
      include/igl/lim/lim.cpp
  80. 2 0
      include/igl/list_to_matrix.cpp
  81. 0 33
      include/igl/load_shader.h
  82. 7 6
      include/igl/matrix_to_list.cpp
  83. 13 10
      include/igl/min_quad_with_fixed.cpp
  84. 1 1
      include/igl/mvc.cpp
  85. 17 13
      include/igl/normal_derivative.cpp
  86. 5 6
      include/igl/on_boundary.cpp
  87. 2 5
      include/igl/opengl/OpenGL_convenience.h
  88. 4 6
      include/igl/opengl/compile_and_link_program.cpp
  89. 32 0
      include/igl/opengl/compile_and_link_program.h
  90. 4 8
      include/igl/opengl/compile_shader.cpp
  91. 38 0
      include/igl/opengl/compile_shader.h
  92. 1 3
      include/igl/opengl/create_index_vbo.cpp
  93. 14 15
      include/igl/opengl/create_index_vbo.h
  94. 2 4
      include/igl/opengl/create_mesh_vbo.cpp
  95. 64 0
      include/igl/opengl/create_mesh_vbo.h
  96. 11 9
      include/igl/opengl/create_shader_program.cpp
  97. 66 0
      include/igl/opengl/create_shader_program.h
  98. 3 5
      include/igl/opengl/create_vector_vbo.cpp
  99. 17 17
      include/igl/opengl/create_vector_vbo.h
  100. 6 3
      include/igl/opengl/destroy_shader_program.cpp

+ 2 - 0
.gitignore

@@ -73,3 +73,5 @@ external/libpng/build
 external/tinyxml2/build
 optional/build
 lib
+tutorial/XXX_test/CMakeLists.txt
+tutorial/XXX_test/main.cpp

+ 2 - 0
.gitmodules

@@ -2,3 +2,5 @@
 	path = external/nanogui
 	url = https://github.com/schuellc/nanogui.git
         fetchRecursiveSubmodules = true
+        ignore = dirty
+

+ 1 - 0
RELEASE_HISTORY.md

@@ -11,6 +11,7 @@ html header:   <script type="text/javascript" src="http://cdn.mathjax.org/mathja
 
 Version | Short description
 --------|----------------------------------------------------------------------
+1.2.1   | Reorganization opengl-dependent functions: opengl and opengl2 extras
 1.2.0   | Reorganization of "extras", rm deprecated funcs, absorb boost & svd3x3
 1.1.7   | Switch build for static library to cmake.
 1.1.6   | Major boolean robustness fix, drop CGAL dependency for AABB/distances

+ 1 - 1
VERSION.txt

@@ -3,4 +3,4 @@
 # Anyone may increment Minor to indicate a small change.
 # Major indicates a large change or large number of changes (upload to website)
 # World indicates a substantial change or release
-1.1.7
+1.2.1

+ 3 - 3
examples/Makefile.conf

@@ -18,7 +18,7 @@ CFLAGS += -std=c++11
 ifeq ($(UNAME), Linux)
 	DEFAULT_PREFIX=/usr/local/
 else
-	DEFAULT_PREFIX=/opt/local/
+	DEFAULT_PREFIX=/usr/local/
 	# I guess arch only works in Mac OSX
 	AFLAGS+=-arch x86_64 -m64 -march=corei7-avx
 endif
@@ -66,7 +66,7 @@ ifeq ($(IGL_USERNAME),ajx)
 #AFLAGS = -m64 -march="corei7-avx"
 	# msse4.2 is necessary for me to get embree to compile correctly
 	AFLAGS=-m64 -msse4.2
-	OPENMP=-fopenmp
+	#OPENMP=-fopenmp
 	EIGEN3_INC=-I$(DEFAULT_PREFIX)/include/eigen3 -I$(DEFAULT_PREFIX)/include/eigen3/unsupported
 	#EIGEN3_INC=-I/Users/ajx/Documents/eigen -I/Users/ajx/Documents/eigen/unsupported
 endif
@@ -248,7 +248,7 @@ endif
 
 ifdef LIBIGL_USE_STATIC_LIBRARY
 	CFLAGS += -DIGL_STATIC_LIBRARY
-	LIBIGL_LIB=-L$(LIBIGL)/lib -ligl
+	LIBIGL_LIB=-L$(LIBIGL)/lib -ligl -liglopengl2 -liglopengl
 endif
 
 OPTFLAGS+=-O3 -DNDEBUG $(OPENMP)

+ 8 - 8
examples/ambient-occlusion/example.cpp

@@ -1,11 +1,11 @@
-#include <igl/OpenGL_convenience.h>
+#include <igl/opengl/OpenGL_convenience.h>
 #include <igl/per_face_normals.h>
 #include <igl/per_vertex_normals.h>
 #include <igl/normalize_row_lengths.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
 #include <igl/quat_to_mat.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/readOBJ.h>
 #include <igl/readDMAT.h>
 #include <igl/readOFF.h>
@@ -76,7 +76,7 @@ void reshape(int width,int height)
   TwWindowSize(width, height);
 }
 
-// Set up projection and model view of scene
+// Set up igl::opengl2::projection and model view of scene
 void push_scene()
 {
   using namespace igl;
@@ -204,7 +204,7 @@ void display()
   // Draw the model
   // Set material properties
   glEnable(GL_COLOR_MATERIAL);
-  draw_mesh(V,F,N,C);
+  igl::opengl2::draw_mesh(V,F,N,C);
 
   pop_object();
 
@@ -215,12 +215,12 @@ void display()
   glTranslated(0,floor_offset,0);
   const float GREY[4] = {0.5,0.5,0.6,1.0};
   const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glPopMatrix();
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();

+ 0 - 1
examples/arap/Makefile

@@ -2,7 +2,6 @@
 
 # Shared flags etc.
 include ../Makefile.conf
-LIBIGL_LIB+=-liglsvd3x3
 
 all: example
 

+ 7 - 7
examples/arap/example.cpp

@@ -1,12 +1,12 @@
 #include <igl/Camera.h>
-#include <igl/OpenGL_convenience.h>
+#include <igl/opengl/OpenGL_convenience.h>
 #include <igl/PI.h>
 #include <igl/STR.h>
 #include <igl/arap.h>
 #include <igl/barycenter.h>
 #include <igl/cotmatrix.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/get_seconds.h>
 #include <igl/harmonic.h>
 #include <igl/invert_diag.h>
@@ -27,7 +27,7 @@
 #include <igl/readOBJ.h>
 #include <igl/readOFF.h>
 #include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
 #include <igl/trackball.h>
@@ -420,7 +420,7 @@ void display()
   //glMaterialf (GL_BACK, GL_SHININESS, 128);
   glEnable(GL_COLOR_MATERIAL);
 
-  draw_mesh(U,F,N,C);
+  igl::opengl2::draw_mesh(U,F,N,C);
   glDisable(GL_COLOR_MATERIAL);
 
   pop_object();
@@ -435,12 +435,12 @@ void display()
   //const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
 
   //draw_floor(GREY,DARK_GREY);
-  draw_floor();
+  igl::opengl2::draw_floor();
   glPopMatrix();
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();

+ 16 - 16
examples/beach-balls/BeachBall.cpp

@@ -1,11 +1,11 @@
 #include "BeachBall.h"
 
 
-#include <igl/draw_beach_ball.h>
+#include <igl/opengl2/draw_beach_ball.h>
 #include <igl/quat_to_mat.h>
-#include <igl/unproject_to_zero_plane.h>
-#include <igl/unproject.h>
-#include <igl/project.h>
+#include <igl/opengl2/unproject_to_zero_plane.h>
+#include <igl/opengl2/unproject.h>
+#include <igl/opengl2/project.h>
 #include <igl/quat_mult.h>
 #include <igl/quat_conjugate.h>
 #include <igl/trackball.h>
@@ -76,7 +76,7 @@ void BeachBall::draw()
   glPushMatrix();
   glScaled(radius,radius,radius);
   // draw oriented glyph 
-  draw_beach_ball();
+  igl::opengl2::draw_beach_ball();
   // Pop scale
   glPopMatrix();
   // Reset lighting
@@ -93,8 +93,8 @@ bool BeachBall::in(const int x,const int y) const
   push();
   // Now origin is center of object
   double obj[3];
-  // Check if unprojected screen point is nearby
-  unproject_to_zero_plane(x,y, &obj[0], &obj[1], &obj[2]);
+  // Check if igl::opengl2::unprojected screen point is nearby
+  igl::opengl2::unproject_to_zero_plane(x,y, &obj[0], &obj[1], &obj[2]);
   bool near = (obj[0]*obj[0] + obj[1]*obj[1] + obj[2]*obj[2])<radius*radius;
   pop();
   popmv();
@@ -136,7 +136,7 @@ bool BeachBall::drag(const int x,const int y)
     pushmv();
     push();
     double origin[3];
-    project(0,0,0,&origin[0],&origin[1],&origin[2]);
+    igl::opengl2::project(0,0,0,&origin[0],&origin[1],&origin[2]);
     pop();
     popmv();
     double rot[4];
@@ -193,20 +193,20 @@ bool BeachBall::drag(const int x,const int y)
   }else
   {
     // We want that origin follows mouse move. First define plane we
-    // projecteing screen mouse movement to as perpendicular plan passing
+    // igl::opengl2::projecteing screen mouse movement to as perpendicular plan passing
     // through this origin.
     pushmv();
-    // down_t projected to screen to get depth value
+    // down_t igl::opengl2::projected to screen to get depth value
     double p[3];
-    project(down_t[0],down_t[1],down_t[2],&p[0],&p[1],&p[2]);
-    // unprojected down_x,down_y with down_t depth
+    igl::opengl2::project(down_t[0],down_t[1],down_t[2],&p[0],&p[1],&p[2]);
+    // igl::opengl2::unprojected down_x,down_y with down_t depth
     double du[3];
-    unproject(down_x,down_y,p[2],&du[0],&du[1],&du[2]);
-    // unprojected x,y with down_t depth
+    igl::opengl2::unproject(down_x,down_y,p[2],&du[0],&du[1],&du[2]);
+    // igl::opengl2::unprojected x,y with down_t depth
     double u[3];
-    unproject(x,y,p[2],&u[0], &u[1], &u[2]);
+    igl::opengl2::unproject(x,y,p[2],&u[0], &u[1], &u[2]);
     popmv();
-    // Then move this origin according to project mouse displacment
+    // Then move this origin according to igl::opengl2::project mouse displacment
     t[0] = down_t[0] + (u[0]-du[0]);
     t[1] = down_t[1] + (u[1]-du[1]);
     t[2] = down_t[2] + (u[2]-du[2]);

+ 2 - 2
examples/beach-balls/example.cpp

@@ -1,7 +1,7 @@
 #include "BeachBall.h"
 
 #include <igl/quat_to_mat.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/trackball.h>
 #include <igl/canonical_quaternions.h>
 #include <igl/PI.h>
@@ -135,7 +135,7 @@ void display()
   //  }
   //}
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
   glutSwapBuffers();
   glutPostRedisplay();
 

+ 8 - 8
examples/camera/example.cpp

@@ -2,7 +2,7 @@
 #include <igl/Viewport.h>
 #include <igl/Camera.h>
 #include <igl/matlab_format.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/anttweakbar/ReAntTweakBar.h>
 #include <igl/trackball.h>
 #include <igl/two_axis_valuator_fixed_up.h>
@@ -10,12 +10,12 @@
 #include <igl/EPS.h>
 #include <igl/get_seconds.h>
 #include <igl/material_colors.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/readOFF.h>
 #include <igl/per_face_normals.h>
-#include <igl/draw_floor.h>
-#include <igl/project.h>
-#include <igl/unproject.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/project.h>
+#include <igl/opengl2/unproject.h>
 
 #include <Eigen/Core>
 #include <Eigen/Geometry>
@@ -354,7 +354,7 @@ void draw_scene(const igl::Camera & v_camera,
   glMaterialfv(GL_BACK, GL_DIFFUSE,  FAST_GREEN_DIFFUSE  );
   glMaterialfv(GL_BACK, GL_SPECULAR, SILVER_SPECULAR);
   glMaterialf (GL_BACK, GL_SHININESS, 128);
-  draw_mesh(V,F,N);
+  igl::opengl2::draw_mesh(V,F,N);
   glDisable(GL_LIGHTING);
   glEnable(GL_COLOR_MATERIAL);
   //glLineWidth(3.f);
@@ -365,7 +365,7 @@ void draw_scene(const igl::Camera & v_camera,
   {
     glPushMatrix();
     glTranslated(0,-1,0);
-    draw_floor();
+    igl::opengl2::draw_floor();
     glPopMatrix();
   }
   
@@ -383,7 +383,7 @@ void draw_scene(const igl::Camera & v_camera,
   glPopMatrix();
   glMatrixMode(GL_MODELVIEW);
   glPopMatrix();
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   if(render_to_texture)
   {

+ 7 - 7
examples/colored-mesh/example.cpp

@@ -1,12 +1,12 @@
-#include <igl/OpenGL_convenience.h>
+#include <igl/opengl/OpenGL_convenience.h>
 #include <igl/per_face_normals.h>
 #include <igl/per_vertex_normals.h>
 #include <igl/two_axis_valuator_fixed_up.h>
 #include <igl/normalize_row_lengths.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
 #include <igl/quat_to_mat.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/readOBJ.h>
 #include <igl/readDMAT.h>
 #include <igl/readOFF.h>
@@ -258,7 +258,7 @@ void display()
   // Draw the model
   // Set material properties
   glEnable(GL_COLOR_MATERIAL);
-  draw_mesh(V,F,N,C);
+  igl::opengl2::draw_mesh(V,F,N,C);
 
   pop_object();
 
@@ -269,12 +269,12 @@ void display()
   glTranslated(0,floor_offset,0);
   const float GREY[4] = {0.5,0.5,0.6,1.0};
   const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glPopMatrix();
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();

+ 1 - 1
examples/components/Makefile

@@ -2,7 +2,7 @@
 
 # Shared flags etc.
 include ../Makefile.conf
-LIBIGL_LIB+=-liglembree -liglboost
+LIBIGL_LIB+=-liglembree 
 
 all: obj example
 

+ 16 - 16
examples/components/example.cpp

@@ -2,16 +2,16 @@
 #include <igl/Camera.h>
 #include <igl/REDRUM.h>
 #include <igl/components.h>
-#include <igl/create_shader_program.h>
-#include <igl/draw_floor.h>
+#include <igl/opengl/create_shader_program.h>
+#include <igl/opengl2/draw_floor.h>
 #include <igl/get_seconds.h>
 #include <igl/hsv_to_rgb.h>
-#include <igl/init_render_to_texture.h>
+#include <igl/opengl/init_render_to_texture.h>
 #include <igl/jet.h>
 #include <igl/per_face_normals.h>
 #include <igl/randperm.h>
 #include <igl/read_triangle_mesh.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/rgb_to_hsv.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
@@ -152,8 +152,8 @@ void reshape(int width, int height)
   // Send the new window size to AntTweakBar
   TwWindowSize(width, height);
   s.camera.m_aspect = (double)width/(double)height;
-  igl::init_render_to_texture(width,height, pick_tex, pick_fbo, pick_dfbo);
-  igl::report_gl_error("init_render_to_texture: ");
+  igl::opengl::init_render_to_texture(width,height, pick_tex, pick_fbo, pick_dfbo);
+  igl::opengl::report_gl_error("init_render_to_texture: ");
   glutPostRedisplay();
 }
 
@@ -231,7 +231,7 @@ void draw_mesh(
 
     glBindBuffer(GL_ARRAY_BUFFER,sbo);
     glBufferData(GL_ARRAY_BUFFER,sizeof(float)*SR.size(),SR.data(),GL_STATIC_DRAW);
-    igl::report_gl_error("glBindBuffer: ");
+    igl::opengl::report_gl_error("glBindBuffer: ");
 
     scene_dirty = false;
   }
@@ -289,11 +289,11 @@ GLuint generate_1d_texture(
   glTexImage1D(GL_TEXTURE_1D, 0, colors.cols(),colors.rows(),
     0,GL_RGB, GL_UNSIGNED_BYTE,
     colors.data());
-  igl::report_gl_error("glTexImage1D: ");
+  igl::opengl::report_gl_error("glTexImage1D: ");
   glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);
   glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_T, GL_CLAMP);
   glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER,GL_NEAREST);
-  igl::report_gl_error("texture: ");
+  igl::opengl::report_gl_error("texture: ");
   return tex_id;
 }
  
@@ -333,7 +333,7 @@ void main()
     colors(id,2) = re;
   }
   tex_id = generate_1d_texture(colors);
-  return igl::create_shader_program(
+  return igl::opengl::create_shader_program(
     vertex_shader.c_str(), 
     fragment_shader.c_str(),
     {{"scalar_in",scalar_loc}}
@@ -519,12 +519,12 @@ void main()
 
     tex_id = generate_1d_texture(colors);
 
-    GLuint prog_id = igl::create_shader_program(
+    GLuint prog_id = igl::opengl::create_shader_program(
       vertex_shader.c_str(), 
       fragment_shader.c_str(),
       {{"scalar_in",scalar_loc}}
       );
-    igl::report_gl_error("create_shader_program: ");
+    igl::opengl::report_gl_error("create_shader_program: ");
     return prog_id;
   };
   static GLuint scalar_loc = 1;
@@ -547,7 +547,7 @@ void main()
     }else
     {
       glUseProgram(color_components_prog);
-      igl::report_gl_error("UseProgram: ");
+      igl::opengl::report_gl_error("UseProgram: ");
       draw_mesh(V,F,N,s.I,scalar_loc);
     }
   }
@@ -556,7 +556,7 @@ void main()
 
   glPushAttrib(GL_ALL_ATTRIB_BITS);
   glUseProgram(color_components_prog);
-    igl::report_gl_error("use: ");
+    igl::opengl::report_gl_error("use: ");
   glUniform1f(glGetUniformLocation(color_components_prog,"cmin"),s.I.minCoeff());
   glUniform1f(glGetUniformLocation(color_components_prog,"cmax"),s.I.maxCoeff());
   //glUniform1f(glGetUniformLocation(color_components_prog,"cc_selected"),cc_selected);
@@ -568,7 +568,7 @@ void main()
   glBindTexture(GL_TEXTURE_1D, s.mask_id);
   glUniform1i(glGetUniformLocation(color_components_prog,"selected_mask"),1);
 
-    igl::report_gl_error("unif: ");
+    igl::opengl::report_gl_error("unif: ");
   if(fill_visible)
   {
     glEnable(GL_POLYGON_OFFSET_FILL); // Avoid Stitching!
@@ -585,7 +585,7 @@ void main()
   glTranslated(0,floor_offset,0);
   const float GREY[4] = {0.5,0.5,0.6,1.0};
   const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glPopMatrix();
 
   pop_scene();

+ 19 - 19
examples/embree/example.cpp

@@ -1,13 +1,13 @@
-#include <igl/OpenGL_convenience.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl/OpenGL_convenience.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/normalize_row_lengths.h>
 #include <igl/per_face_normals.h>
 #include <igl/quat_to_mat.h>
 #include <igl/read_triangle_mesh.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/trackball.h>
-#include <igl/unproject.h>
+#include <igl/opengl2/unproject.h>
 #include <igl/embree/EmbreeIntersector.h>
 
 #ifdef __APPLE__
@@ -129,7 +129,7 @@ void lights()
   glLightfv(GL_LIGHT1,GL_POSITION,pos);
 }
 
-// Set up projection and model view of scene
+// Set up igl::opengl2::projection and model view of scene
 void push_scene()
 {
   using namespace igl;
@@ -208,7 +208,7 @@ void display()
 
   // Draw the model
   glEnable(GL_LIGHTING);
-  draw_mesh(V,F,N,C);
+  igl::opengl2::draw_mesh(V,F,N,C);
 
   // Draw all hits
   glBegin(GL_POINTS);
@@ -234,7 +234,7 @@ void display()
   glPushMatrix();
   glEnable(GL_LIGHTING);
   glTranslated(0,-1,0);
-  draw_floor();
+  igl::opengl2::draw_floor();
   glPopMatrix();
 
   // draw a transparent "projection screen" show model at time of hit (aka
@@ -290,7 +290,7 @@ void display()
     glVertex2fv(win_s.data());
     glEnd();
   }
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   glutSwapBuffers();
   glutPostRedisplay();
@@ -318,12 +318,12 @@ void mouse_move(int mouse_x, int mouse_y)
   // Unproject mouse at 0 depth and some positive depth
   win_s = Vector3f(mouse_x,height-mouse_y,0);
   Vector3f win_d(mouse_x,height-mouse_y,1);
-  unproject(win_s,s);
-  unproject(win_d,d);
+  igl::opengl2::unproject(win_s,s);
+  igl::opengl2::unproject(win_d,d);
   pop_object();
   pop_scene();
-  report_gl_error();
-  // Shoot ray at unprojected mouse in view direction
+  igl::opengl::report_gl_error();
+  // Shoot ray at igl::opengl2::unprojected mouse in view direction
   dir = d-s;
   int num_rays_shot;
   ei.intersectRay(s,dir,hits,num_rays_shot);
@@ -365,16 +365,16 @@ void mouse(int glutButton, int glutState, int mouse_x, int mouse_y)
       // Collect "projection screen" locations
       push_scene();
       push_object();
-      // unproject corners of window
+      // igl::opengl2::unproject corners of window
       const double depth = 0.999;
       Vector3d win_NW(    0,height,depth);
       Vector3d win_NE(width,height,depth);
       Vector3d win_SE(width,0,depth);
       Vector3d win_SW(0,0,depth);
-      unproject(win_NW,NW);
-      unproject(win_NE,NE);
-      unproject(win_SE,SE);
-      unproject(win_SW,SW);
+      igl::opengl2::unproject(win_NW,NW);
+      igl::opengl2::unproject(win_NE,NE);
+      igl::opengl2::unproject(win_SE,SE);
+      igl::opengl2::unproject(win_SW,SW);
       // render to framebuffer
       glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fbo_id);
       glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, dfbo_id);
@@ -386,7 +386,7 @@ void mouse(int glutButton, int glutState, int mouse_x, int mouse_y)
       glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
       glEnable(GL_LIGHTING);
       glEnable(GL_DEPTH_TEST);
-      draw_mesh(V,F,N,C);
+      igl::opengl2::draw_mesh(V,F,N,C);
       pop_object();
       pop_scene();
       glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);

+ 16 - 16
examples/flare-eyes/example.cpp

@@ -2,10 +2,10 @@
 #include <igl/PI.h>
 #include <igl/REDRUM.h>
 #include <igl/STR.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/get_seconds.h>
-#include <igl/lens_flare.h>
+#include <igl/opengl2/lens_flare.h>
 #include <igl/list_to_matrix.h>
 #include <igl/material_colors.h>
 #include <igl/pathinfo.h>
@@ -16,8 +16,8 @@
 #include <igl/readOBJ.h>
 #include <igl/readOFF.h>
 #include <igl/readWRL.h>
-#include <igl/render_to_tga.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/render_to_tga.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
 #include <igl/trackball.h>
@@ -60,7 +60,7 @@
 bool eyes_visible = true;
 double x=6,y=232,z=61;
 
-std::vector<igl::Flare> flares;
+std::vector<igl::opengl2::Flare> flares;
 std::vector<GLuint> shine_ids;
 std::vector<GLuint> flare_ids;
 int shine_tic = 0;
@@ -222,7 +222,7 @@ void draw_flare()
   glScaled(bbd*0.5,bbd*0.5,bbd*0.5);
   glScaled(0.2,0.2,0.2);
   Vector3f light(0,0,0);
-  lens_flare_draw(flares,shine_ids,flare_ids,light,1.0,shine_tic);
+  igl::opengl2::lens_flare_draw(flares,shine_ids,flare_ids,light,1.0,shine_tic);
   glPopMatrix();
 }
 
@@ -335,7 +335,7 @@ void display()
     glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE,  MIDNIGHT_BLUE_DIFFUSE);
     glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, SILVER_SPECULAR);
     glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 128);
-    draw_mesh(V,F,N);
+    igl::opengl2::draw_mesh(V,F,N);
     pop_object();
     // Draw a nice floor
     glPushMatrix();
@@ -344,7 +344,7 @@ void display()
     glTranslated(0,floor_offset,0);
     const float GREY[4] = {0.5,0.5,0.6,1.0};
     const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
-    draw_floor(GREY,DARK_GREY);
+    igl::opengl2::draw_floor(GREY,DARK_GREY);
     glPopMatrix();
 
     glEndList();
@@ -361,13 +361,13 @@ void display()
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   if(render_to_tga_on_next)
   {
     GLint viewport[4];
     glGetIntegerv(GL_VIEWPORT,viewport);
-    render_to_tga(
+    igl::opengl::render_to_tga(
       STR("./"<< "flare-eyes-" << setw(4) << setfill('0') << render_count++ << ".tga"),
       viewport[2],viewport[3],true);
     //render_to_tga_on_next = false;
@@ -722,16 +722,16 @@ int main(int argc, char * argv[])
   glutMotionFunc(mouse_drag);
   glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT);
   // Init flares
-  lens_flare_load_textures(shine_ids,flare_ids);
+  igl::opengl2::lens_flare_load_textures(shine_ids,flare_ids);
   const float RED[3] = {1,0,0};
   const float GREEN[3] = {0,1,0};
   const float BLUE[3] = {0,0,1};
   //lens_flare_create(RED,GREEN,BLUE,flares);
   flares.resize(4);
-  flares[0] = Flare(-1, 1.0f, 1.*0.1f,  RED, 1.0);
-  flares[1] = Flare(-1, 1.0f, 1.*0.15f, GREEN, 1.0);
-  flares[2] = Flare(-1, 1.0f, 1.*0.35f, BLUE, 1.0);
-  flares[3] = Flare( 2, 1.0f, 1.*0.1f, BLUE, 0.4);
+  flares[0] = igl::opengl2::Flare(-1, 1.0f, 1.*0.1f,  RED, 1.0);
+  flares[1] = igl::opengl2::Flare(-1, 1.0f, 1.*0.15f, GREEN, 1.0);
+  flares[2] = igl::opengl2::Flare(-1, 1.0f, 1.*0.35f, BLUE, 1.0);
+  flares[3] = igl::opengl2::Flare( 2, 1.0f, 1.*0.1f, BLUE, 0.4);
 
   glutMainLoop();
 

+ 8 - 8
examples/intersections/example.cpp

@@ -1,9 +1,9 @@
 #include <igl/Camera.h>
-#include <igl/OpenGL_convenience.h>
+#include <igl/opengl/OpenGL_convenience.h>
 #include <igl/barycenter.h>
 #include <igl/cat.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/get_seconds.h>
 #include <igl/jet.h>
 #include <igl/list_to_matrix.h>
@@ -19,7 +19,7 @@
 #include <igl/readOBJ.h>
 #include <igl/readOFF.h>
 #include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
 #include <igl/trackball.h>
@@ -278,7 +278,7 @@ void display()
     glEnable(GL_POLYGON_OFFSET_FILL); // Avoid Stitching!
     glPolygonOffset(1.0,1);
     glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
-    draw_mesh(V,F,N,C);
+    igl::opengl2::draw_mesh(V,F,N,C);
     glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
     glDisable(GL_COLOR_MATERIAL);
     const float black[4] = {0,0,0,1};
@@ -290,7 +290,7 @@ void display()
     glLightfv(GL_LIGHT0, GL_DIFFUSE, black);
     glLineWidth(1.0);
     glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
-    draw_mesh(V,F,N,C);
+    igl::opengl2::draw_mesh(V,F,N,C);
     glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
     glEnable(GL_COLOR_MATERIAL);
   };
@@ -312,12 +312,12 @@ void display()
   glTranslated(0,floor_offset,0);
   const float GREY[4] = {0.5,0.5,0.6,1.0};
   const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glPopMatrix();
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();

+ 16 - 16
examples/multi-viewport/example.cpp

@@ -1,21 +1,21 @@
 #include <igl/Camera.h>
 #include <igl/EPS.h>
-#include <igl/OpenGL_convenience.h>
+#include <igl/opengl/OpenGL_convenience.h>
 #include <igl/STR.h>
 #include <igl/Viewport.h>
 #include <igl/canonical_quaternions.h>
-#include <igl/draw_beach_ball.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/draw_beach_ball.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/normalize_row_lengths.h>
 #include <igl/per_face_normals.h>
-#include <igl/project.h>
+#include <igl/opengl2/project.h>
 #include <igl/quat_to_mat.h>
 #include <igl/read_triangle_mesh.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/trackball.h>
-#include <igl/unproject.h>
-#include <igl/unproject_to_zero_plane.h>
+#include <igl/opengl2/unproject.h>
+#include <igl/opengl2/unproject_to_zero_plane.h>
 
 #ifdef __APPLE__
 #  include <OpenGL/gl.h>
@@ -31,7 +31,7 @@
 #include <string>
 #include <algorithm>
 #define IGL_HEADER_ONLY
-#include <igl/draw_floor.h>
+#include <igl/opengl2/draw_floor.h>
 
 #define NUM_VIEWPORTS 4
 class AugViewport : public igl::Viewport
@@ -171,7 +171,7 @@ void lights()
   glLightfv(GL_LIGHT1,GL_POSITION,pos);
 }
 
-// Set up projection and model view of scene
+// Set up igl::opengl2::projection and model view of scene
 void push_scene(const AugViewport & vp)
 {
   using namespace igl;
@@ -246,7 +246,7 @@ void display()
     push_object();
     // Draw the model
     glEnable(GL_LIGHTING);
-    draw_mesh(V,F,N,C);
+    igl::opengl2::draw_mesh(V,F,N,C);
     pop_object();
 
     // Draw a nice floor
@@ -255,11 +255,11 @@ void display()
     glEnable(GL_CULL_FACE);
     glEnable(GL_LIGHTING);
     glTranslated(0,-1,0);
-    if(project(Vector3d(0,0,0))(2) - project(Vector3d(0,1,0))(2) > -FLOAT_EPS)
+    if(igl::opengl2::project(Vector3d(0,0,0))(2) - igl::opengl2::project(Vector3d(0,1,0))(2) > -FLOAT_EPS)
     {
-      draw_floor_outline();
+      igl::opengl2::draw_floor_outline();
     }
-    draw_floor();
+    igl::opengl2::draw_floor();
     glPopMatrix();
     glDisable(GL_CULL_FACE);
 
@@ -269,7 +269,7 @@ void display()
       glPushMatrix();
       glTranslated(ball(0),ball(1),ball(2));
       glScaled(0.1,0.1,0.1);
-      draw_beach_ball();
+      igl::opengl2::draw_beach_ball();
       glPopMatrix();
     }
 
@@ -318,7 +318,7 @@ void display()
   glEnd();
 
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   glutSwapBuffers();
 }
@@ -356,7 +356,7 @@ void mouse_move(int mouse_x, int mouse_y)
         viewports[in_vp].height);
       push_scene(viewports[in_vp]);
       Vector3d screen_ball(mouse_x,height-mouse_y,0);
-      unproject_to_zero_plane(screen_ball,ball);
+      igl::opengl2::unproject_to_zero_plane(screen_ball,ball);
       pop_scene();
     }
   }

+ 1 - 1
examples/patches/Makefile

@@ -3,7 +3,7 @@
 # Shared flags etc.
 include ../Makefile.conf
 ifdef LIBIGL_USE_STATIC_LIBRARY
-	LIBIGL_LIB+=-liglembree -liglboost
+	LIBIGL_LIB+=-liglembree
 endif
 
 all: obj example

+ 8 - 8
examples/patches/example.cpp

@@ -3,8 +3,8 @@
 #include <igl/REDRUM.h>
 #include <igl/bfs_orient.h>
 #include <igl/components.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/get_seconds.h>
 #include <igl/jet.h>
 #include <igl/list_to_matrix.h>
@@ -21,7 +21,7 @@
 #include <igl/readOFF.h>
 #include <igl/readPLY.h>
 #include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
 #include <igl/trackball.h>
@@ -295,10 +295,10 @@ void display()
     if(fill_visible)
     {
       glColor3f(0,0,0);
-      draw_mesh(V,F,s.N);
+      igl::opengl2::draw_mesh(V,F,s.N);
     }else
     {
-      draw_mesh(V,F,s.N,s.C);
+      igl::opengl2::draw_mesh(V,F,s.N,s.C);
     }
 
     // visualize selected patch
@@ -338,7 +338,7 @@ void display()
   {
     glEnable(GL_POLYGON_OFFSET_FILL); // Avoid Stitching!
     glPolygonOffset(1.0, 0);
-    draw_mesh(V,F,s.N,s.C);
+    igl::opengl2::draw_mesh(V,F,s.N,s.C);
   }
 
   pop_object();
@@ -350,12 +350,12 @@ void display()
   glTranslated(0,floor_offset,0);
   const float GREY[4] = {0.5,0.5,0.6,1.0};
   const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glPopMatrix();
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();

+ 6 - 6
examples/randomly-sample-mesh/example.cpp

@@ -1,7 +1,7 @@
 #include <igl/Camera.h>
 #include <igl/REDRUM.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/get_seconds.h>
 #include <igl/list_to_matrix.h>
 #include <igl/material_colors.h>
@@ -14,7 +14,7 @@
 #include <igl/readOBJ.h>
 #include <igl/readOFF.h>
 #include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
 #include <igl/trackball.h>
@@ -240,7 +240,7 @@ void display()
   glMaterialf (GL_BACK, GL_SHININESS, 128);
 
 
-  draw_mesh(V,F,N);
+  igl::opengl2::draw_mesh(V,F,N);
 
   glPointSize(3.);
   glEnable(GL_POINT_SMOOTH);
@@ -262,12 +262,12 @@ void display()
   glTranslated(0,floor_offset,0);
   const float GREY[4] = {0.5,0.5,0.6,1.0};
   const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glPopMatrix();
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();

+ 8 - 8
examples/rotate-widget/example.cpp

@@ -1,8 +1,8 @@
 #include <igl/Camera.h>
 #include <igl/REDRUM.h>
-#include <igl/RotateWidget.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/RotateWidget.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/get_seconds.h>
 #include <igl/list_to_matrix.h>
 #include <igl/material_colors.h>
@@ -15,7 +15,7 @@
 #include <igl/readOFF.h>
 #include <igl/readTGF.h>
 #include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
 #include <igl/trackball.h>
@@ -63,7 +63,7 @@ Eigen::VectorXi P;
 struct State
 {
   igl::Camera camera;
-  igl::RotateWidget widget;
+  igl::opengl2::RotateWidget widget;
 } s;
 
 bool wireframe = false;
@@ -251,7 +251,7 @@ void display()
   const float GREY[4] = {0.5,0.5,0.6,1.0};
   const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
   glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glPopMatrix();
 
   push_object();
@@ -272,7 +272,7 @@ void display()
   glTranslated( s.widget.pos(0), s.widget.pos(1), s.widget.pos(2));
   glMultMatrixd(Affine3d(s.widget.rot).matrix().data());
   glTranslated( -s.widget.pos(0), -s.widget.pos(1), -s.widget.pos(2));
-  draw_mesh(V,F,N);
+  igl::opengl2::draw_mesh(V,F,N);
   glPopMatrix();
 
   if(widget_on_top)
@@ -286,7 +286,7 @@ void display()
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();

+ 6 - 6
examples/scene-rotation/example.cpp

@@ -5,8 +5,8 @@
 
 #include <igl/Camera.h>
 #include <igl/REDRUM.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/get_seconds.h>
 #include <igl/list_to_matrix.h>
 #include <igl/material_colors.h>
@@ -18,7 +18,7 @@
 #include <igl/readOBJ.h>
 #include <igl/readOFF.h>
 #include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
 #include <igl/trackball.h>
@@ -262,7 +262,7 @@ void display()
   glMaterialf (GL_BACK, GL_SHININESS, 128);
 
 
-  draw_mesh(V,F,N);
+  igl::opengl2::draw_mesh(V,F,N);
   pop_object();
 
   // Draw a nice floor
@@ -272,12 +272,12 @@ void display()
   glTranslated(0,floor_offset,0);
   const float GREY[4] = {0.5,0.5,0.6,1.0};
   const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glPopMatrix();
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();

+ 1 - 1
examples/scene-rotation/trackball.cpp

@@ -177,7 +177,7 @@ trackball(float q[4], float p1x, float p1y, float p2x, float p2y)
     }
 
     /*
-     * First, figure out z-coordinates for projection of P1 and P2 to
+     * First, figure out z-coordinates for igl::opengl2::projection of P1 and P2 to
      * deformed sphere
      */
     vset(p1,p1x,p1y,tb_project_to_sphere(TRACKBALLSIZE,p1x,p1y));

+ 6 - 6
examples/shadow-mapping/example.cpp

@@ -3,8 +3,8 @@
 
 #include <igl/C_STR.h>
 #include <igl/REDRUM.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/get_seconds.h>
 #include <igl/jet.h>
 #include <igl/list_to_matrix.h>
@@ -20,7 +20,7 @@
 #include <igl/readOBJ.h>
 #include <igl/readOFF.h>
 #include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/trackball.h>
 #include <igl/unique_simplices.h>
@@ -244,7 +244,7 @@ void push_scene(
   double z_fix = 1.0;
   // 5 is far enough to see unit "things" well
   const double camera_z = 2;
-  // Test if should be using true orthographic projection
+  // Test if should be using true orthographic igl::opengl2::projection
   if(angle == 0)
   {
     glOrtho(
@@ -377,7 +377,7 @@ void draw_objects()
     glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 128);
     glPushMatrix();
     glMultMatrixd(mesh.a.matrix().data());
-    draw_mesh(mesh.V,mesh.F,mesh.N);
+    igl::opengl2::draw_mesh(mesh.V,mesh.F,mesh.N);
     glPopMatrix();
   }
 
@@ -472,7 +472,7 @@ void display()
 
   draw_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
   TwDraw();
   glutSwapBuffers();
   glutPostRedisplay();

+ 39 - 27
examples/skeleton-builder/example.cpp

@@ -6,10 +6,10 @@
 #include <igl/boundary_conditions.h>
 #include <igl/centroid.h>
 #include <igl/colon.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_skeleton_3d.h>
-#include <igl/draw_skeleton_vector_graphics.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
+#include <igl/opengl2/draw_skeleton_3d.h>
+#include <igl/opengl2/draw_skeleton_vector_graphics.h>
 #include <igl/file_exists.h>
 #include <igl/forward_kinematics.h>
 #include <igl/get_seconds.h>
@@ -20,21 +20,22 @@
 #include <igl/normalize_row_sums.h>
 #include <igl/pathinfo.h>
 #include <igl/per_face_normals.h>
-#include <igl/project.h>
+#include <igl/opengl2/project.h>
 #include <igl/quat_to_mat.h>
 #include <igl/readTGF.h>
 #include <igl/read_triangle_mesh.h>
 #include <igl/remove_unreferenced.h>
-#include <igl/report_gl_error.h>
-#include <igl/right_axis.h>
+#include <igl/opengl/report_gl_error.h>
+#include <igl/opengl2/right_axis.h>
 #include <igl/slice.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/sort_triangles.h>
+#include <igl/opengl2/sort_triangles.h>
 #include <igl/trackball.h>
 #include <igl/two_axis_valuator_fixed_up.h>
 #include <igl/unique.h>
-#include <igl/unproject.h>
+#include <igl/opengl2/unproject.h>
+#include <igl/opengl2/model_proj_viewport.h>
 #include <igl/writeOBJ.h>
 #include <igl/writeOFF.h>
 #include <igl/writeTGF.h>
@@ -248,7 +249,7 @@ void sort()
   push_scene();
   push_object();
   VectorXi I;
-  sort_triangles(V,F,sorted_F,I);
+  igl::opengl2::sort_triangles(V,F,sorted_F,I);
   slice(N,I,1,sorted_N);
   pop_object();
   pop_scene();
@@ -301,7 +302,7 @@ void display()
   glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glDisable(GL_CULL_FACE);
   glPopMatrix();
 
@@ -325,11 +326,11 @@ void display()
             }
           }
         }
-        draw_skeleton_3d(s.C,s.BE,MatrixXd(),colors,bbd*0.5);
+        igl::opengl2::draw_skeleton_3d(s.C,s.BE,MatrixXd(),colors,bbd*0.5);
         break;
       }
       case SKEL_STYLE_TYPE_VECTOR_GRAPHICS:
-        draw_skeleton_vector_graphics(s.C,s.BE);
+        igl::opengl2::draw_skeleton_vector_graphics(s.C,s.BE);
         break;
     }
   };
@@ -361,7 +362,7 @@ void display()
     glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
   }
   glLineWidth(1.0);
-  draw_mesh(V,sorted_F,sorted_N);
+  igl::opengl2::draw_mesh(V,sorted_F,sorted_N);
   glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
 
   if(skeleton_on_top)
@@ -373,7 +374,7 @@ void display()
   pop_object();
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();
@@ -468,7 +469,7 @@ bool ss_select(
   for(int c = 0;c<C.rows();c++)
   {
     const RowVector3d & Cc = C.row(c);
-    const auto Pc = project(Cc);
+    const auto Pc = igl::opengl2::project(Cc);
     const double SELECTION_DIST = 18;//pixels
     const double dist = (Pc.head(2)-RowVector2d(mouse_x,height-mouse_y)).norm();
     if(dist < SELECTION_DIST && (accum || dist < min_dist))
@@ -662,17 +663,24 @@ void mouse_drag(int mouse_x, int mouse_y)
       down_C = s.C;
       new_leaf_on_drag = false;
     }
+      Eigen::Matrix4f model,proj;
+      Eigen::Vector4f viewport;
+      igl::opengl2::model_proj_viewport(model,proj,viewport);
+      Eigen::Vector2f pos(mouse_x,height-mouse_y);
     if(new_root_on_drag)
     {
       // two new nodes
       s.C.conservativeResize(s.C.rows()+2,3);
       const int nc = s.C.rows();
       Vector3d obj;
-      int nhits = igl::embree::unproject_in_mesh(mouse_x,height-mouse_y,ei,obj);
+
+      int nhits = igl::embree::unproject_in_mesh(
+          pos,model,proj,viewport,ei,obj);
+
       if(nhits == 0)
       {
-        Vector3d pV_mid = project(Vcen);
-        obj = unproject(Vector3d(mouse_x,height-mouse_y,pV_mid(2)));
+        Vector3d pV_mid = igl::opengl2::project(Vcen);
+        obj = igl::opengl2::unproject(Vector3d(mouse_x,height-mouse_y,pV_mid(2)));
       }
       s.C.row(nc-2) = obj;
       s.C.row(nc-1) = obj;
@@ -688,21 +696,21 @@ void mouse_drag(int mouse_x, int mouse_y)
     }
     double z = 0;
     Vector3d obj,win;
-    int nhits = igl::embree::unproject_in_mesh(mouse_x,height-mouse_y,ei,obj);
-    project(obj,win);
+    int nhits = igl::embree::unproject_in_mesh(pos,model,proj,viewport,ei,obj);
+    igl::opengl2::project(obj,win);
     z = win(2);
 
     for(int si = 0;si<s.sel.size();si++)
     {
       const int c = s.sel(si);
-      Vector3d pc = project((RowVector3d) down_C.row(c));
+      Vector3d pc = igl::opengl2::project((RowVector3d) down_C.row(c));
       pc(0) += mouse_x-down_x;
       pc(1) += (height-mouse_y)-(height-down_y);
       if(nhits > 0)
       {
         pc(2) = z;
       }
-      s.C.row(c) = unproject(pc);
+      s.C.row(c) = igl::opengl2::unproject(pc);
     }
     pop_object();
     pop_scene();
@@ -762,7 +770,7 @@ void symmetrize()
   push_scene();
   push_object();
   Vector3d right;
-  right_axis(right.data(),right.data()+1,right.data()+2);
+  igl::opengl2::right_axis(right.data(),right.data()+1,right.data()+2);
   right.normalize();
   MatrixXd RC(s.C.rows(),s.C.cols());
   MatrixXd old_C = s.C;
@@ -1014,9 +1022,13 @@ void key(unsigned char key, int mouse_x, int mouse_y)
       push_object();
       for(int c = 0;c<s.C.rows();c++)
       {
-        Vector3d P = project((Vector3d)s.C.row(c));
+        Vector3d P = igl::opengl2::project((Vector3d)s.C.row(c));
         Vector3d obj;
-        int nhits = igl::embree::unproject_in_mesh(P(0),P(1),ei,obj);
+        Eigen::Matrix4f model,proj;
+        Eigen::Vector4f viewport;
+        igl::opengl2::model_proj_viewport(model,proj,viewport);
+        Eigen::Vector2f pos(P(0),P(1));
+        int nhits = igl::embree::unproject_in_mesh(pos,model,proj,viewport,ei,obj);
         if(nhits > 0)
         {
           s.C.row(c) = obj;
@@ -1105,7 +1117,7 @@ int main(int argc, char * argv[])
   cout<<"P,p                    Split \"parent\" bone(s) of selection by creating new node(s)."<<endl;
   cout<<"R,r                    Breadth first search at selection to redirect skeleton into tree."<<endl;
   cout<<"S,s                    Save current skeleton to output .tgf file."<<endl;
-  cout<<"U,u                    Project then unproject inside mesh (as if dragging each by ε)."<<endl;
+  cout<<"U,u                    Project then igl::opengl2::unproject inside mesh (as if dragging each by ε)."<<endl;
   cout<<"Y,Y                    Symmetrize selection over plane through object centroid and right vector."<<endl;
   cout<<"Z,z                    Snap to canonical view."<<endl;
   cout<<"⌘ Z                    Undo."<<endl;

+ 15 - 14
examples/skeleton-poser/example.cpp

@@ -1,5 +1,5 @@
 #include <igl/Camera.h>
-#include <igl/MouseController.h>
+#include <igl/opengl2/MouseController.h>
 #include <igl/REDRUM.h>
 #include <igl/STR.h>
 #include <igl/barycenter.h>
@@ -8,11 +8,11 @@
 #include <igl/boundary_facets.h>
 #include <igl/centroid.h>
 #include <igl/colon.h>
-#include <igl/draw_beach_ball.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_skeleton_3d.h>
-#include <igl/draw_skeleton_vector_graphics.h>
+#include <igl/opengl2/draw_beach_ball.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
+#include <igl/opengl2/draw_skeleton_3d.h>
+#include <igl/opengl2/draw_skeleton_vector_graphics.h>
 #include <igl/forward_kinematics.h>
 #include <igl/get_seconds.h>
 #include <igl/lbs_matrix.h>
@@ -26,7 +26,7 @@
 #include <igl/readTGF.h>
 #include <igl/read_triangle_mesh.h>
 #include <igl/remove_unreferenced.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
 #include <igl/trackball.h>
@@ -97,7 +97,7 @@ Eigen::VectorXi P,RP;
 
 struct State
 {
-  igl::MouseController mouse;
+  igl::opengl2::MouseController mouse;
   Eigen::MatrixXf colors;
 } s;
 
@@ -295,7 +295,7 @@ void display()
   glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glDisable(GL_CULL_FACE);
   glPopMatrix();
 
@@ -308,11 +308,11 @@ void display()
       default:
       case SKEL_STYLE_TYPE_3D:
       {
-        draw_skeleton_3d(C,BE,T,s.colors,bbd*0.5);
+        igl::opengl2::draw_skeleton_3d(C,BE,T,s.colors,bbd*0.5);
         break;
       }
       case SKEL_STYLE_TYPE_VECTOR_GRAPHICS:
-        draw_skeleton_vector_graphics(C,BE,T);
+        igl::opengl2::draw_skeleton_vector_graphics(C,BE,T);
         break;
     }
   };
@@ -359,7 +359,7 @@ void display()
   MatrixXd U = M*T;
   MatrixXd UN;
   per_face_normals(U,F,UN);
-  draw_mesh(U,F,UN);
+  igl::opengl2::draw_mesh(U,F,UN);
   glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
   glDisable(GL_DEPTH_TEST);
   draw_skeleton(T);
@@ -375,7 +375,7 @@ void display()
     glScaled(0.1,0.1,0.1);
     glEnable(GL_POLYGON_OFFSET_FILL);
     glPolygonOffset(0,-100000);
-    draw_beach_ball();
+    igl::opengl2::draw_beach_ball();
     glDisable(GL_POLYGON_OFFSET_FILL);
     glPopMatrix();
   }
@@ -389,7 +389,7 @@ void display()
   pop_object();
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();
@@ -459,6 +459,7 @@ void mouse(int glutButton, int glutState, int mouse_x, int mouse_y)
           if(mouse_was_selecting)
           {
             s.mouse.set_selection_from_last_drag(C,BE,P,RP);
+            using namespace igl::opengl2;
             MouseController::VectorXb S;
             MouseController::propogate_to_descendants_if(
               s.mouse.selection(),P,S);

+ 10 - 10
examples/skeleton/example.cpp

@@ -1,10 +1,10 @@
 #include <igl/Camera.h>
 #include <igl/REDRUM.h>
 #include <igl/boundary_conditions.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_skeleton_3d.h>
-#include <igl/draw_skeleton_vector_graphics.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
+#include <igl/opengl2/draw_skeleton_3d.h>
+#include <igl/opengl2/draw_skeleton_vector_graphics.h>
 #include <igl/forward_kinematics.h>
 #include <igl/get_seconds.h>
 #include <igl/lbs_matrix.h>
@@ -20,7 +20,7 @@
 #include <igl/readOFF.h>
 #include <igl/readTGF.h>
 #include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
 #include <igl/trackball.h>
@@ -255,7 +255,7 @@ void display()
   const float GREY[4] = {0.5,0.5,0.6,1.0};
   const float DARK_GREY[4] = {0.2,0.2,0.3,1.0};
   glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glPopMatrix();
 
   push_object();
@@ -296,7 +296,7 @@ void display()
   glLineWidth(1.0);
   MatrixXd U = M*T;
   per_face_normals(U,F,N);
-  draw_mesh(U,F,N);
+  igl::opengl2::draw_mesh(U,F,N);
   glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
 
   if(skeleton_on_top)
@@ -308,10 +308,10 @@ void display()
   {
     default:
     case SKEL_STYLE_TYPE_3D:
-      draw_skeleton_3d(C,BE,T,MAYA_VIOLET,bbd*0.5);
+      igl::opengl2::draw_skeleton_3d(C,BE,T,MAYA_VIOLET,bbd*0.5);
       break;
     case SKEL_STYLE_TYPE_VECTOR_GRAPHICS:
-      draw_skeleton_vector_graphics(C,BE,T);
+      igl::opengl2::draw_skeleton_vector_graphics(C,BE,T);
       break;
   }
 
@@ -319,7 +319,7 @@ void display()
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();

+ 7 - 8
examples/textured-mesh/example.cpp

@@ -1,9 +1,9 @@
 #include <igl/Camera.h>
-#include <igl/OpenGL_convenience.h>
+#include <igl/opengl/OpenGL_convenience.h>
 #include <igl/STR.h>
 #include <igl/barycenter.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/get_seconds.h>
 #include <igl/jet.h>
 #include <igl/list_to_matrix.h>
@@ -20,10 +20,9 @@
 #include <igl/readOBJ.h>
 #include <igl/readOFF.h>
 #include <igl/readWRL.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/snap_to_canonical_view_quat.h>
 #include <igl/snap_to_fixed_up.h>
-#include <igl/texture_from_tga.h>
 #include <igl/trackball.h>
 #include <igl/two_axis_valuator_fixed_up.h>
 #include <igl/anttweakbar/ReAntTweakBar.h>
@@ -287,7 +286,7 @@ void display()
   }
   glMatrixMode(GL_MODELVIEW);
 
-  draw_mesh(V,F,N,MatrixXi(),MatrixXd(),TC,TF,MatrixXd(),0,MatrixXi(),0);
+  igl::opengl2::draw_mesh(V,F,N,MatrixXi(),MatrixXd(),TC,TF,MatrixXd(),0,MatrixXi(),0);
 
   glMatrixMode(GL_TEXTURE);
   glPopMatrix();
@@ -320,12 +319,12 @@ void display()
   glDisable(GL_POLYGON_OFFSET_FILL);
   glDisable(GL_TEXTURE_2D);
 
-  draw_floor(GREY,DARK_GREY);
+  igl::opengl2::draw_floor(GREY,DARK_GREY);
   glPopMatrix();
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
 
   TwDraw();
   glutSwapBuffers();

+ 1 - 1
examples/transparency/Makefile

@@ -7,7 +7,7 @@ all: example
 
 .PHONY: example
 
-CFLAGS+=-O3 -fopenmp
+CFLAGS+=-O3 
 
 INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC)
 LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB)

+ 12 - 12
examples/transparency/example.cpp

@@ -1,8 +1,8 @@
 #include <igl/EPS.h>
-#include <igl/OpenGL_convenience.h>
+#include <igl/opengl/OpenGL_convenience.h>
 #include <igl/colon.h>
-#include <igl/draw_floor.h>
-#include <igl/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
 #include <igl/jet.h>
 #include <igl/material_colors.h>
 #include <igl/matlab_format.h>
@@ -10,12 +10,12 @@
 #include <igl/per_face_normals.h>
 #include <igl/quat_to_mat.h>
 #include <igl/read_triangle_mesh.h>
-#include <igl/report_gl_error.h>
-#include <igl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
+#include <igl/opengl/report_gl_error.h>
 #include <igl/slice.h>
-#include <igl/sort_triangles.h>
+#include <igl/opengl2/sort_triangles.h>
 #include <igl/trackball.h>
-#include <igl/unproject.h>
+#include <igl/opengl2/unproject.h>
 #include <igl/anttweakbar/ReAntTweakBar.h>
 
 #ifdef __APPLE__
@@ -87,7 +87,7 @@ void lights()
   glLightfv(GL_LIGHT1,GL_POSITION,pos);
 }
 
-// Set up projection and model view of scene
+// Set up igl::opengl2::projection and model view of scene
 void push_scene()
 {
   using namespace igl;
@@ -154,7 +154,7 @@ void mouse(int glutButton, int glutState, int mouse_x, int mouse_y)
       // sort!
       push_scene();
       push_object();
-      sort_triangles(V,F,sorted_F,I);
+      igl::opengl2::sort_triangles(V,F,sorted_F,I);
       slice(N,I,1,sorted_N);
       init_C(I);
       pop_object();
@@ -206,7 +206,7 @@ void display()
   glTranslated(0,-1000*FLOAT_EPS,0);
   glEnable(GL_CULL_FACE);
   glCullFace(GL_BACK);
-  draw_floor();
+  igl::opengl2::draw_floor();
   pop_object();
 
   glDisable(GL_CULL_FACE);
@@ -241,12 +241,12 @@ void display()
 
   push_object();
   // Draw the model
-  draw_mesh(V,sorted_F,sorted_N,C);
+  igl::opengl2::draw_mesh(V,sorted_F,sorted_N,C);
   pop_object();
 
   pop_scene();
 
-  report_gl_error();
+  igl::opengl::report_gl_error();
   glutSwapBuffers();
   glutPostRedisplay();
 }

+ 5 - 5
examples/upright/example.cpp

@@ -9,8 +9,8 @@
 // lost in the output file.
 //
 #include <igl/read_triangle_mesh.h>
-#include <igl/draw_mesh.h>
-#include <igl/draw_floor.h>
+#include <igl/opengl2/draw_mesh.h>
+#include <igl/opengl2/draw_floor.h>
 #include <igl/pathinfo.h>
 #include <igl/list_to_matrix.h>
 #include <igl/per_face_normals.h>
@@ -99,7 +99,7 @@ void push_scene()
   double z_fix = 1.0;
   // 5 is far enough to see unit "things" well
   const double camera_z = 2;
-  // Test if should be using true orthographic projection
+  // Test if should be using true orthographic igl::opengl2::projection
   if(angle == 0)
   {
     glOrtho(
@@ -194,7 +194,7 @@ void display()
   glMaterialf (GL_BACK, GL_SHININESS, 128);
 
 
-  draw_mesh(s.V,s.F,s.N);
+  igl::opengl2::draw_mesh(s.V,s.F,s.N);
 
   glDisable(GL_LIGHTING);
   glPushMatrix();
@@ -230,7 +230,7 @@ void display()
   glEnable(GL_LIGHTING);
   glPushMatrix();
   glTranslated(0,-1,0);
-  draw_floor();
+  igl::opengl2::draw_floor();
   glPopMatrix();
   pop_scene();
 

+ 2 - 2
google-soc/index.html

@@ -18,7 +18,7 @@
 
 <figure>
 <img src="./libigl-logo-python-matlab.jpg" alt="" />
-<figcaption></figcaption></figure>
+</figure>
 
 <p>Libigl is a C++ library, but its functional interface make it very friendly to
 wrapping individual functions for popular scripting languages like Python or
@@ -39,7 +39,7 @@ variety of functions in the library.</p>
 
 <figure>
 <img src="./collapse-split-flip.jpg" alt="" />
-<figcaption></figcaption></figure>
+</figure>
 
 <p>Libigl avoids complicated mesh data-structures to ensure that its interface is
 clean and easy to port into users&#8217; existing projects. Our mesh format is a

+ 0 - 1
include/igl/AABB.h

@@ -1037,7 +1037,6 @@ inline void igl::AABB<DerivedV,DIM>::leaf_squared_distance(
   }
   const auto & point_point_squared_distance = [&](const RowVectorDIMS & s)
   {
-    cout<<"pp"<<endl;
     const Scalar sqr_d_s = (p-s).squaredNorm();
     set_min(p,sqr_d_s,m_primitive,s,sqr_d,i,c);
   };

+ 1 - 1
include/igl/ARAPEnergyType.h

@@ -22,7 +22,7 @@ namespace igl
   //       deformation" by [Chao et al.  2010], rotations defined at elements
   //       (triangles or tets) 
   //     ARAP_ENERGY_TYPE_DEFAULT  Choose one automatically: spokes and rims
-  //       for surfaces, elements for planar meshes and test (not fully
+  //       for surfaces, elements for planar meshes and tets (not fully
   //       supported)
   enum ARAPEnergyType
   {

+ 4 - 2
include/igl/arap.cpp

@@ -153,7 +153,8 @@ IGL_INLINE bool igl::arap_precomputation(
     assert(h != 0);
     SparseMatrix<double> M;
     massmatrix(V,F,MASSMATRIX_TYPE_DEFAULT,data.M);
-    SparseMatrix<double> DQ = 1./(h*h)*data.M;
+    const double dw = (1./data.ym)*(h*h);
+    SparseMatrix<double> DQ = dw * 1./(h*h)*data.M;
     Q += DQ;
     // Dummy external forces
     data.f_ext = MatrixXd::Zero(n,data.dim);
@@ -268,7 +269,8 @@ IGL_INLINE bool igl::arap_solve(
       // h*data.vel = (V0-Vm1)
       // -h*data.vel = -V0+Vm1)
       // -V0-h*data.vel = -2V0+Vm1
-      Dl = 1./(h*h)*data.M*(-U0 - h*data.vel) - data.f_ext;
+      const double dw = (1./data.ym)*(h*h);
+      Dl = dw * (1./(h*h)*data.M*(-U0 - h*data.vel) - data.f_ext);
     }
 
     VectorXd Rcol;

+ 3 - 0
include/igl/arap.h

@@ -26,6 +26,7 @@ namespace igl
     // f_ext  #V by dim list of external forces
     // vel  #V by dim list of velocities
     // h  dynamics time step
+    // ym  ~Young's modulus smaller is softer, larger is more rigid/stiff
     // max_iter  maximum inner iterations
     // K  rhs pre-multiplier
     // M  mass matrix
@@ -38,6 +39,7 @@ namespace igl
     bool with_dynamics;
     Eigen::MatrixXd f_ext,vel;
     double h;
+    double ym;
     int max_iter;
     Eigen::SparseMatrix<double> K,M;
     Eigen::SparseMatrix<double> CSM;
@@ -51,6 +53,7 @@ namespace igl
         with_dynamics(false),
         f_ext(),
         h(1),
+        ym(1),
         max_iter(10),
         K(),
         CSM(),

+ 43 - 9
include/igl/biharmonic_coordinates.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 "biharmonic_coordinates.h"
 #include "cotmatrix.h"
@@ -23,11 +23,26 @@ IGL_INLINE bool igl::biharmonic_coordinates(
   const Eigen::PlainObjectBase<DerivedT> & T,
   const std::vector<std::vector<SType> > & S,
   Eigen::PlainObjectBase<DerivedW> & W)
+{
+  return biharmonic_coordinates(V,T,S,2,W);
+}
+
+template <
+  typename DerivedV,
+  typename DerivedT,
+  typename SType,
+  typename DerivedW>
+IGL_INLINE bool igl::biharmonic_coordinates(
+  const Eigen::PlainObjectBase<DerivedV> & V,
+  const Eigen::PlainObjectBase<DerivedT> & T,
+  const std::vector<std::vector<SType> > & S,
+  const int k,
+  Eigen::PlainObjectBase<DerivedW> & W)
 {
   using namespace Eigen;
   using namespace std;
   // This is not the most efficient way to build A, but follows "Linear
-  // Subspace Design for Real-Time Shape Deformation" [Wang et al. 2015]. 
+  // Subspace Design for Real-Time Shape Deformation" [Wang et al. 2015].
   SparseMatrix<double> A;
   {
     SparseMatrix<double> N,Z,L,K,M;
@@ -58,12 +73,26 @@ IGL_INLINE bool igl::biharmonic_coordinates(
     cotmatrix(V,T,L);
     K = N+L;
     massmatrix(V,T,MASSMATRIX_TYPE_DEFAULT,M);
-    DiagonalMatrix<double,Dynamic> Minv = 
+    // normalize
+    M /= ((VectorXd)M.diagonal()).array().abs().maxCoeff();
+    DiagonalMatrix<double,Dynamic> Minv =
       ((VectorXd)M.diagonal().array().inverse()).asDiagonal();
-    A = K.transpose() * (Minv * K);
+    switch(k)
+    {
+      default:
+        assert(false && "unsupported");
+      case 2:
+        // For C1 smoothness in 2D, one should use bi-harmonic
+        A = K.transpose() * (Minv * K);
+        break;
+      case 3:
+        // For C1 smoothness in 3D, one should use tri-harmonic
+        A = K.transpose() * (Minv * (-L * (Minv * K)));
+        break;
+    }
   }
   // Vertices in point handles
-  const size_t mp = 
+  const size_t mp =
     count_if(S.begin(),S.end(),[](const vector<int> & h){return h.size()==1;});
   // number of region handles
   const size_t r = S.size()-mp;
@@ -110,8 +139,13 @@ IGL_INLINE bool igl::biharmonic_coordinates(
       }
     }
   }
-  // minimize    ½ W' A W' 
+  // minimize    ½ W' A W'
   // subject to  W(b,:) = J
   return min_quad_with_fixed(
     A,VectorXd::Zero(A.rows()).eval(),b,J,{},VectorXd(),true,W);
 }
+
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template specialization
+template bool igl::biharmonic_coordinates<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, int, 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&, std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+#endif

+ 13 - 0
include/igl/biharmonic_coordinates.h

@@ -70,6 +70,19 @@ namespace igl
     const Eigen::PlainObjectBase<DerivedT> & T,
     const std::vector<std::vector<SType> > & S,
     Eigen::PlainObjectBase<DerivedW> & W);
+  // k  2-->biharmonic, 3-->triharmonic
+  template <
+    typename DerivedV,
+    typename DerivedT,
+    typename SType,
+    typename DerivedW>
+  IGL_INLINE bool biharmonic_coordinates(
+    const Eigen::PlainObjectBase<DerivedV> & V,
+    const Eigen::PlainObjectBase<DerivedT> & T,
+    const std::vector<std::vector<SType> > & S,
+    const int k,
+    Eigen::PlainObjectBase<DerivedW> & W);
+
 };
 #  ifndef IGL_STATIC_LIBRARY
 #    include "biharmonic_coordinates.cpp"

+ 2 - 4
include/igl/boolean/mesh_boolean.cpp

@@ -11,9 +11,8 @@
 #include <igl/cgal/remesh_self_intersections.h>
 #include <igl/remove_unreferenced.h>
 #include <igl/unique_simplices.h>
-#include <iostream>
-
 #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
+#include <iostream>
 
 //#define IGL_MESH_BOOLEAN_DEBUG
 
@@ -152,7 +151,7 @@ IGL_INLINE void igl::boolean::mesh_boolean(
     MatrixX3I SF;
     MatrixX2I SIF;
     VectorXI SIM,UIM;
-    RemeshSelfIntersectionsParam params;
+    igl::cgal::RemeshSelfIntersectionsParam params;
     remesh_self_intersections(V,F,params,SV,SF,SIF,J,SIM);
     for_each(SF.data(),SF.data()+SF.size(),[&SIM](int & a){a=SIM(a);});
     {
@@ -312,7 +311,6 @@ IGL_INLINE void igl::boolean::mesh_boolean(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-
 // This is a hack to discuss
 #include <igl/remove_unreferenced.cpp>
 

+ 1 - 1
include/igl/bounding_box_diagonal.cpp

@@ -22,5 +22,5 @@ IGL_INLINE double igl::bounding_box_diagonal(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 #endif

+ 3 - 1
include/igl/cat.cpp

@@ -36,7 +36,9 @@ IGL_INLINE void igl::cat(
     return;
   }
 
-  SparseMatrix<Scalar, RowMajor> dyn_C;
+  // This **must** be DynamicSparseMatrix, otherwise this implementation is
+  // insanely slow
+  DynamicSparseMatrix<Scalar, RowMajor> dyn_C;
   if(dim == 1)
   {
     assert(A.cols() == B.cols());

+ 1 - 1
include/igl/cgal/mesh_to_polyhedron.cpp

@@ -47,7 +47,7 @@ IGL_INLINE bool igl::cgal::mesh_to_polyhedron(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 #include <CGAL/Simple_cartesian.h>
 #include <CGAL/Polyhedron_items_with_id_3.h>
 template bool igl::cgal::mesh_to_polyhedron<CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> > >(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> >&);

+ 1 - 1
include/igl/cgal/peel_outer_hull_layers.cpp

@@ -17,7 +17,6 @@
 #include "../STR.h"
 #endif
 
-using namespace std;
 template <
   typename DerivedV,
   typename DerivedF,
@@ -126,6 +125,7 @@ IGL_INLINE size_t igl::cgal::peel_outer_hull_layers(
   Eigen::PlainObjectBase<Derivedodd > & odd,
   Eigen::PlainObjectBase<Derivedflip > & flip)
 {
+  using namespace std;
   Eigen::Matrix<typename DerivedV::Scalar,DerivedF::RowsAtCompileTime,3> N;
   per_face_normals(V,F,N);
   return peel_outer_hull_layers(V,F,N,odd,flip);

+ 1 - 1
include/igl/cgal/polyhedron_to_mesh.cpp

@@ -57,7 +57,7 @@ IGL_INLINE void igl::cgal::polyhedron_to_mesh(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 #include <CGAL/Simple_cartesian.h>
 #include <CGAL/Polyhedron_items_with_id_3.h>
 template void igl::cgal::polyhedron_to_mesh<CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> > >(CGAL::Polyhedron_3<CGAL::Simple_cartesian<double>, CGAL::Polyhedron_items_with_id_3, CGAL::HalfedgeDS_default, std::allocator<int> > const&, Eigen::Matrix<double, -1, -1, 0, -1, -1>&, Eigen::Matrix<int, -1, -1, 0, -1, -1>&);

+ 1 - 0
include/igl/colon.cpp

@@ -51,4 +51,5 @@ template void igl::colon<int, int, long, int>(int, int, long, Eigen::Matrix<int,
 template void igl::colon<int, long, int>(int, long, Eigen::Matrix<int, -1, 1, 0, -1, 1>&);
 template void igl::colon<int, int, int>(int, int, Eigen::Matrix<int, -1, 1, 0, -1, 1>&);
 template void igl::colon<int,long long int,int>(int,long long int,Eigen::Matrix<int,-1,1,0,-1,1> &);
+template void igl::colon<int, int, int, int>(int, int, int, Eigen::Matrix<int, -1, 1, 0, -1, 1>&);
 #endif

+ 1 - 1
include/igl/comiso/miq.cpp.REMOVED.git-id

@@ -1 +1 @@
-6ac6a3c6a26d8ec8e1cc351df0b57a5080fa766d
+9414a8a8bd01b1058bead042c96dbf6eaf0f9b9d

+ 0 - 33
include/igl/compile_and_link_program.h

@@ -1,33 +0,0 @@
-// 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
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_COMPILE_AND_LINK_PROGRAM_H
-#define IGL_COMPILE_AND_LINK_PROGRAM_H
-#include "igl_inline.h"
-#include "OpenGL_convenience.h"
-namespace igl
-{
-  #ifndef IGL_NO_OPENGL
-
-  // Compile and link very simple vertex/fragment shaders
-  //
-  // Inputs:
-  //   v_str  string of vertex shader contents
-  //   f_str  string of fragment shader contents
-  // Returns id of program
-  //
-  // Known bugs: this seems to duplicate `create_shader_program` with less
-  // 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"
-#endif
-#endif

+ 0 - 38
include/igl/compile_shader.h

@@ -1,38 +0,0 @@
-// 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
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_COMPILE_SHADER_H
-#define IGL_COMPILE_SHADER_H
-#include "OpenGL_convenience.h"
-#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
-  // Returns result of glCreateShader (id of shader)
-  //
-  // Example:
-  //     GLuint vid = compile_shader(GL_VERTEX_SHADER,vertex_shader.c_str());
-  //     GLuint fid = compile_shader(GL_FRAGMENT_SHADER,fragment_shader.c_str());
-  //     GLuint prog_id = glCreateProgram();
-  //     glAttachShader(prog_id,vid);
-  //     glAttachShader(prog_id,fid);
-  //     glLinkProgram(prog_id);
-  //
-  // 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"
-#endif
-#endif

+ 1 - 0
include/igl/components.cpp

@@ -88,4 +88,5 @@ IGL_INLINE void igl::components(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template void igl::components<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
+template void igl::components<int, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::SparseMatrix<int, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

+ 0 - 63
include/igl/create_mesh_vbo.h

@@ -1,63 +0,0 @@
-// 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 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_CREATE_MESH_VBO_H
-#define IGL_CREATE_MESH_VBO_H
-#ifndef IGL_NO_OPENGL
-#include "igl_inline.h"
-// NOTE: It wouldn't be so hard to template this using Eigen's templates
-
-#include <Eigen/Core>
-
-#include "OpenGL_convenience.h"
-
-// Create a VBO (Vertex Buffer Object) for a mesh. Actually two VBOs: one 
-// GL_ARRAY_BUFFER for the vertex positions (V) and one
-// GL_ELEMENT_ARRAY_BUFFER for the triangle indices (F)
-namespace igl
-{
-
-  // Inputs:
-  //   V  #V by 3 eigen Matrix of mesh vertex 3D positions
-  //   F  #F by 3 eigne Matrix of face (triangle) indices
-  // Outputs:
-  //   V_vbo_id  buffer id for vertex positions
-  //   F_vbo_id  buffer id for face indices
-  //
-  // NOTE: when using glDrawElements VBOs for V and F using MatrixXd and
-  // MatrixXi will have types GL_DOUBLE and GL_UNSIGNED_INT respectively
-  //
-  IGL_INLINE void create_mesh_vbo(
-    const Eigen::MatrixXd & V,
-    const Eigen::MatrixXi & F,
-    GLuint & V_vbo_id,
-    GLuint & F_vbo_id);
-
-  // Inputs:
-  //   V  #V by 3 eigen Matrix of mesh vertex 3D positions
-  //   F  #F by 3 eigne Matrix of face (triangle) indices
-  //   N  #V by 3 eigen Matrix of mesh vertex 3D normals
-  // Outputs:
-  //   V_vbo_id  buffer id for vertex positions
-  //   F_vbo_id  buffer id for face indices
-  //   N_vbo_id  buffer id for vertex positions
-  IGL_INLINE void create_mesh_vbo(
-    const Eigen::MatrixXd & V,
-    const Eigen::MatrixXi & F,
-    const Eigen::MatrixXd & N,
-    GLuint & V_vbo_id,
-    GLuint & F_vbo_id,
-    GLuint & N_vbo_id);
-
-}
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "create_mesh_vbo.cpp"
-#endif
-
-#endif
-#endif

+ 0 - 65
include/igl/create_shader_program.h

@@ -1,65 +0,0 @@
-// 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 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_CREATE_SHADER_PROGRAM_H
-#define IGL_CREATE_SHADER_PROGRAM_H
-
-#ifndef IGL_NO_OPENGL
-#include "igl_inline.h"
-#include <string>
-#include <map>
-
-#include "OpenGL_convenience.h"
-
-namespace igl
-{
-  // Create a shader program with a vertex and fragments shader loading from
-  // source strings and vertex attributes assigned from a map before linking the
-  // shaders to the program, making it ready to use with glUseProgram(id)
-  // Inputs:
-  //   geom_source  string containing source code of geometry shader (can be
-  //     "" to mean use default pass-through)
-  //   vert_source  string containing source code of vertex shader
-  //   frag_source  string containing source code of fragment shader
-  //   attrib  map containing table of vertex attribute strings add their
-  //   correspondingly ids (generated previously using glBindAttribLocation)
-  // Outputs:
-  //   id  index id of created shader, set to 0 on error
-  // Returns true on success, false on error
-  //
-  // Note: Caller is responsible for making sure that current value of id is not
-  // leaking a shader (since it will be overwritten)
-  //
-  // See also: destroy_shader_program
-  IGL_INLINE bool create_shader_program(
-    const std::string &geom_source,
-    const std::string &vert_source,
-    const std::string &frag_source,
-    const std::map<std::string,GLuint> &attrib,
-    GLuint & id);
-  IGL_INLINE bool create_shader_program(
-    const std::string &vert_source,
-    const std::string &frag_source,
-    const std::map<std::string,GLuint> &attrib,
-    GLuint & id);
-  IGL_INLINE GLuint create_shader_program(
-    const std::string & geom_source,
-    const std::string & vert_source,
-    const std::string & frag_source,
-    const std::map<std::string,GLuint> &attrib);
-  IGL_INLINE GLuint create_shader_program(
-    const std::string & vert_source,
-    const std::string & frag_source,
-    const std::map<std::string,GLuint> &attrib);
-}
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "create_shader_program.cpp"
-#endif
-
-#endif
-#endif

+ 0 - 35
include/igl/destroy_shader_program.h

@@ -1,35 +0,0 @@
-// 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 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_DESTROY_SHADER_PROGRAM_H
-#define IGL_DESTROY_SHADER_PROGRAM_H
-#ifndef IGL_NO_OPENGL
-#include "igl_inline.h"
-
-#include "OpenGL_convenience.h"
-
-namespace igl
-{
-  // Properly destroy a shader program. Detach and delete each of its shaders
-  // and delete it
-  // Inputs:
-  //   id  index id of created shader, set to 0 on error
-  // Returns true on success, false on error
-  // 
-  // Note: caller is responsible for making sure he doesn't foolishly continue
-  // to use id as if it still contains a program
-  // 
-  // See also: create_shader_program
-  IGL_INLINE bool destroy_shader_program(const GLuint id);
-}
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "destroy_shader_program.cpp"
-#endif
-
-#endif
-#endif

+ 1 - 1
include/igl/directed_edge_orientations.cpp

@@ -24,6 +24,6 @@ IGL_INLINE void igl::directed_edge_orientations(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 template void igl::directed_edge_orientations<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&, std::vector<Eigen::Quaternion<double, 0>, Eigen::aligned_allocator<Eigen::Quaternion<double, 0> > >&);
 #endif

+ 1 - 1
include/igl/directed_edge_parents.cpp

@@ -29,6 +29,6 @@ IGL_INLINE void igl::directed_edge_parents(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 template void igl::directed_edge_parents<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
 #endif

+ 1 - 1
include/igl/dqs.cpp

@@ -69,6 +69,6 @@ IGL_INLINE void igl::dqs(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 template void igl::dqs<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Quaternion<double, 0>, Eigen::aligned_allocator<Eigen::Quaternion<double, 0> >, Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, std::vector<Eigen::Quaternion<double, 0>, Eigen::aligned_allocator<Eigen::Quaternion<double, 0> > > const&, std::vector<Eigen::Matrix<double, 3, 1, 0, 3, 1>, std::allocator<Eigen::Matrix<double, 3, 1, 0, 3, 1> > > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 #endif

+ 0 - 58
include/igl/draw_floor.h

@@ -1,58 +0,0 @@
-// 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 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_DRAW_FLOOR_H
-#define IGL_DRAW_FLOOR_H
-#ifndef IGL_NO_OPENGL
-#include "igl_inline.h"
-namespace igl
-{
-  // Draw a checkerboard floor aligned with current (X,Z) plane using OpenGL
-  // calls. side=50 centered at (0,0):
-  //   (-25,-25)-->(-25,25)-->(25,25)-->(25,-25)
-  //
-  // Use glPushMatrix(), glScaled(), glTranslated() to arrange the floor.
-  // 
-  // Inputs:
-  //   colorA  float4 color
-  //   colorB  float4 color
-  //
-  // Example:
-  //   // Draw a nice floor
-  //   glPushMatrix();
-  //   glCullFace(GL_BACK);
-  //   glEnable(GL_CULL_FACE);
-  //   glEnable(GL_LIGHTING);
-  //   glTranslated(0,-1,0);
-  //   if(project(Vector3d(0,0,0))(2) - project(Vector3d(0,1,0))(2) > -FLOAT_EPS)
-  //   {
-  //     draw_floor_outline();
-  //   }
-  //   draw_floor();
-  //   glPopMatrix();
-  //   glDisable(GL_CULL_FACE);
-  //
-  IGL_INLINE void draw_floor(
-    const float * colorA, 
-    const float * colorB, 
-    const int GridSizeX=100, 
-    const int GridSizeY=100);
-  // Wrapper with default colors
-  IGL_INLINE void draw_floor();
-  IGL_INLINE void draw_floor_outline(
-    const float * colorA, 
-    const float * colorB, 
-    const int GridSizeX=100, 
-    const int GridSizeY=100);
-  // Wrapper with default colors
-  IGL_INLINE void draw_floor_outline();
-}
-#ifndef IGL_STATIC_LIBRARY
-#  include "draw_floor.cpp"
-#endif
-#endif
-#endif

+ 0 - 121
include/igl/draw_mesh.h

@@ -1,121 +0,0 @@
-// 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 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_DRAW_MESH_H
-#define IGL_DRAW_MESH_H
-#ifndef IGL_NO_OPENGL
-#include "igl_inline.h"
-
-#include <Eigen/Dense>
-
-#include "OpenGL_convenience.h"
-
-namespace igl
-{
-  // Draw OpenGL commands needed to display a mesh with normals
-  //
-  // Inputs:
-  //   V  #V by 3 eigen Matrix of mesh vertex 3D positions
-  //   F  #F by 3|4 eigen Matrix of face (triangle/quad) indices
-  //   N  #V|#F by 3 eigen Matrix of 3D normals
-  IGL_INLINE void draw_mesh(
-    const Eigen::MatrixXd & V,
-    const Eigen::MatrixXi & F,
-    const Eigen::MatrixXd & N);
-  
-  // Draw OpenGL commands needed to display a mesh with normals and per-vertex
-  // colors
-  //
-  // Inputs:
-  //   V  #V by 3 eigen Matrix of mesh vertex 3D positions
-  //   F  #F by 3|4 eigen Matrix of face (triangle/quad) indices
-  //   N  #V|#F by 3 eigen Matrix of 3D normals
-  //   C  #V|#F|1 by 3 eigen Matrix of RGB colors
-  IGL_INLINE void draw_mesh(
-    const Eigen::MatrixXd & V,
-    const Eigen::MatrixXi & F,
-    const Eigen::MatrixXd & N,
-    const Eigen::MatrixXd & C);
-  // Inputs:
-  //   V  #V by 3 eigen Matrix of mesh vertex 3D positions
-  //   F  #F by 3|4 eigen Matrix of face (triangle/quad) indices
-  //   N  #V|#F by 3 eigen Matrix of 3D normals
-  //   C  #V|#F|1 by 3 eigen Matrix of RGB colors
-  //   TC  #V|#F|1 by 3 eigen Matrix of Texture Coordinates
-  IGL_INLINE void draw_mesh(
-    const Eigen::MatrixXd & V,
-    const Eigen::MatrixXi & F,
-    const Eigen::MatrixXd & N,
-    const Eigen::MatrixXd & C,
-    const Eigen::MatrixXd & TC);
-  
-  // Draw OpenGL commands needed to display a mesh with normals, per-vertex
-  // colors and LBS weights
-  //
-  // Inputs:
-  //   V  #V by 3 eigen Matrix of mesh vertex 3D positions
-  //   F  #F by 3|4 eigen Matrix of face (triangle/quad) indices
-  //   N  #V by 3 eigen Matrix of mesh vertex 3D normals
-  //   C  #V by 3 eigen Matrix of mesh vertex RGB colors
-  //   TC  #V by 3 eigen Matrix of mesh vertex UC coorindates between 0 and 1
-  //   W  #V by #H eigen Matrix of per mesh vertex, per handle weights
-  //   W_index  Specifies the index of the "weight" vertex attribute: see
-  //     glBindAttribLocation, if W_index is 0 then weights are ignored
-  //   WI  #V by #H eigen Matrix of per mesh vertex, per handle weight ids
-  //   WI_index  Specifies the index of the "weight" vertex attribute: see
-  //     glBindAttribLocation, if WI_index is 0 then weight indices are ignored
-  IGL_INLINE void draw_mesh(
-    const Eigen::MatrixXd & V,
-    const Eigen::MatrixXi & F,
-    const Eigen::MatrixXd & N,
-    const Eigen::MatrixXd & C,
-    const Eigen::MatrixXd & TC,
-    const Eigen::MatrixXd & W,
-    const GLuint W_index,
-    const Eigen::MatrixXi & WI,
-    const GLuint WI_index);
-  
-  // Draw OpenGL commands needed to display a mesh with normals, per-vertex
-  // colors and LBS weights
-  //
-  // Inputs:
-  //   V  #V by 3 eigen Matrix of mesh vertex 3D positions
-  //   F  #F by 3|4 eigen Matrix of face (triangle/quad) indices
-  //   N  #V by 3 eigen Matrix of mesh vertex 3D normals
-  //   NF  #F by 3 eigen Matrix of face (triangle/quad) normal indices, <0
-  //     means no normal
-  //   C  #V by 3 eigen Matrix of mesh vertex RGB colors
-  //   TC  #V by 3 eigen Matrix of mesh vertex UC coorindates between 0 and 1
-  //   TF  #F by 3 eigen Matrix of face (triangle/quad) texture indices, <0
-  //     means no texture
-  //   W  #V by #H eigen Matrix of per mesh vertex, per handle weights
-  //   W_index  Specifies the index of the "weight" vertex attribute: see
-  //     glBindAttribLocation, if W_index is 0 then weights are ignored
-  //   WI  #V by #H eigen Matrix of per mesh vertex, per handle weight ids
-  //   WI_index  Specifies the index of the "weight" vertex attribute: see
-  //     glBindAttribLocation, if WI_index is 0 then weight indices are ignored
-  IGL_INLINE void draw_mesh(
-    const Eigen::MatrixXd & V,
-    const Eigen::MatrixXi & F,
-    const Eigen::MatrixXd & N,
-    const Eigen::MatrixXi & NF,
-    const Eigen::MatrixXd & C,
-    const Eigen::MatrixXd & TC,
-    const Eigen::MatrixXi & TF,
-    const Eigen::MatrixXd & W,
-    const GLuint W_index,
-    const Eigen::MatrixXi & WI,
-    const GLuint WI_index);
-
-}
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "draw_mesh.cpp"
-#endif
-
-#endif
-#endif

+ 0 - 45
include/igl/draw_point.h

@@ -1,45 +0,0 @@
-// 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 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_DRAW_POINT_H
-#define IGL_DRAW_POINT_H
-#ifndef IGL_NO_OPENGL
-#include "igl_inline.h"
-#include <Eigen/Core>
-namespace igl
-{
-  //double POINT_COLOR[3] = {239./255.,213./255.,46./255.};
-  // Draw a nice looking, colored dot at a given point in 3d.
-  //
-  // Note: expects that GL_CURRENT_COLOR is set with the desired foreground color
-  // 
-  // Inputs:
-  //   x  x-coordinate of point, modelview coordinates
-  //   y  y-coordinate of point, modelview coordinates
-  //   z  z-coordinate of point, modelview coordinates
-  //   requested_r  outer-most radius of dot {7}, measured in screen space pixels
-  //   selected  fills inner circle with black {false}
-  // Asserts that requested_r does not exceed 0.5*GL_POINT_SIZE_MAX
-  IGL_INLINE void draw_point(
-    const double x,
-    const double y,
-    const double z,
-    const double requested_r = 7,
-    const bool selected = false);
-  template <typename DerivedP>
-  IGL_INLINE void draw_point(
-    const Eigen::PlainObjectBase<DerivedP> & P,
-    const double requested_r = 7,
-    const bool selected = false);
-}
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "draw_point.cpp"
-#endif
-
-#endif
-#endif

+ 0 - 36
include/igl/draw_rectangular_marquee.h

@@ -1,36 +0,0 @@
-// 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
-// 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.
-  //
-  // Inputs:
-  //   from_x  x coordinate of from point
-  //   from_y  y coordinate of from point
-  //   to_x  x coordinate of to point
-  //   to_y  y coordinate of to point
-  IGL_INLINE void draw_rectangular_marquee(
-    const int from_x,
-    const int from_y,
-    const int to_x,
-    const int to_y);
-
-    #endif
-}
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "draw_rectangular_marquee.cpp"
-#endif
-
-#endif

+ 0 - 54
include/igl/draw_skeleton_3d.h

@@ -1,54 +0,0 @@
-// 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
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_DRAW_SKELETON_3D_H
-#define IGL_DRAW_SKELETON_3D_H
-#include "igl_inline.h"
-#include "material_colors.h"
-#include <Eigen/Core>
-namespace igl
-{
-
-  #ifndef IGL_NO_OPENGL
-
-  // Draw a skeleton
-  //
-  // Inputs:
-  //   C  #C by dim List of joint rest positions
-  //   BE  #BE by 2 list of bone edge indices into C
-  //   T  #BE*(dim+1) by dim  matrix of stacked transposed bone transformations
-  //   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 Derivedcolor>
-  IGL_INLINE void draw_skeleton_3d(
-    const Eigen::PlainObjectBase<DerivedC> & C,
-    const Eigen::PlainObjectBase<DerivedBE> & BE,
-    const Eigen::PlainObjectBase<DerivedT> & T,
-    const Eigen::PlainObjectBase<Derivedcolor> & color,
-    const double half_bbd=0.5);
-  // Default color
-  template <typename DerivedC, typename DerivedBE, typename DerivedT>
-  IGL_INLINE void draw_skeleton_3d(
-    const Eigen::PlainObjectBase<DerivedC> & C,
-    const Eigen::PlainObjectBase<DerivedBE> & BE,
-    const Eigen::PlainObjectBase<DerivedT> & T);
-  template <typename DerivedC, typename DerivedBE>
-  IGL_INLINE void draw_skeleton_3d(
-    const Eigen::PlainObjectBase<DerivedC> & C,
-    const Eigen::PlainObjectBase<DerivedBE> & BE);
-};
-
-  #endif
-  
-#ifndef IGL_STATIC_LIBRARY
-#  include "draw_skeleton_3d.cpp"
-#endif
-#endif

+ 0 - 53
include/igl/draw_skeleton_vector_graphics.h

@@ -1,53 +0,0 @@
-// 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
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_DRAW_SKELETON_VECTOR_GRAPHICS_H
-#define IGL_DRAW_SKELETON_VECTOR_GRAPHICS_H
-#include "igl_inline.h"
-#include <Eigen/Core>
-
-namespace igl
-{
-  #ifndef IGL_NO_OPENGL
-
-  // Draw a skeleton with a 2D vector graphcis style à la BBW, STBS, Monotonic,
-  // FAST papers.
-  //
-  // Inputs:
-  //   C  #C by dim list of joint positions
-  //   BE #BE by 2 list of bone edge indices into C
-  //  point_color  color of points
-  //  line_color  color of lines
-  IGL_INLINE void draw_skeleton_vector_graphics(
-    const Eigen::MatrixXd & C,
-    const Eigen::MatrixXi & BE,
-    const float * point_color,
-    const float * line_color);
-  // Use default colors (originally from BBW paper)
-  IGL_INLINE void draw_skeleton_vector_graphics(
-    const Eigen::MatrixXd & C,
-    const Eigen::MatrixXi & BE);
-  //   T  #BE*(dim+1) by dim  matrix of stacked transposed bone transformations
-  template <typename DerivedC, typename DerivedBE, typename DerivedT>
-  IGL_INLINE void draw_skeleton_vector_graphics(
-    const Eigen::PlainObjectBase<DerivedC> & C,
-    const Eigen::PlainObjectBase<DerivedBE> & BE,
-    const Eigen::PlainObjectBase<DerivedT> & T,
-    const float * point_color,
-    const float * line_color);
-  template <typename DerivedC, typename DerivedBE, typename DerivedT>
-  IGL_INLINE void draw_skeleton_vector_graphics(
-    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

+ 5 - 0
include/igl/eigs.cpp

@@ -149,3 +149,8 @@ IGL_INLINE bool igl::eigs(
   sU /= sqrt(rescale);
   return true;
 }
+
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template specialization
+template bool igl::eigs<double, double, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::SparseMatrix<double, 0, int> const&, Eigen::SparseMatrix<double, 0, int> const&, unsigned long, igl::EigsType, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
+#endif

+ 3 - 0
include/igl/eigs.h

@@ -13,6 +13,9 @@ namespace igl
   //
   // Solutions are approximate and sorted. 
   //
+  // Ideally one should use ARPACK and the Eigen unsupported ARPACK module.
+  // This implementation does simple, naive power iterations.
+  //
   // Inputs:
   //   A  #A by #A symmetric matrix
   //   B  #A by #A symmetric positive-definite matrix

+ 7 - 2
include/igl/embree/EmbreeIntersector.h

@@ -400,8 +400,10 @@ inline bool igl::embree::EmbreeIntersector::intersectBeam(
   else
     bestHit.t = 0;
 
-  if(hasHit = (intersectRay(origin,direction,hit,tnear,tfar,mask) && (hit.gid == geoId || geoId == -1)))
+  if((intersectRay(origin,direction,hit,tnear,tfar,mask) && (hit.gid == geoId || geoId == -1)))
+  {
     bestHit = hit;
+  }
 
   // sample points around actual ray (conservative hitcheck)
   const float eps= 1e-5;
@@ -413,7 +415,10 @@ inline bool igl::embree::EmbreeIntersector::intersectBeam(
 
   for(int r=0;r<samples;r++)
   {
-    if(intersectRay(origin+offset*eps,direction,hit,tnear,tfar,mask) && ((closestHit && (hit.t < bestHit.t)) || (!closestHit && (hit.t > bestHit.t))) && (hit.gid == geoId || geoId == -1))
+    if(intersectRay(origin+offset*eps,direction,hit,tnear,tfar,mask) && 
+        ((closestHit && (hit.t < bestHit.t)) || 
+           (!closestHit && (hit.t > bestHit.t)))  &&
+        (hit.gid == geoId || geoId == -1))
     {
       bestHit = hit;
       hasHit = true;

+ 1 - 1
include/igl/embree/ambient_occlusion.cpp

@@ -77,7 +77,7 @@ IGL_INLINE void igl::embree::ambient_occlusion(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 template void igl::embree::ambient_occlusion<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
 template void igl::embree::ambient_occlusion<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
 template void igl::embree::ambient_occlusion<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<double, -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&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);

+ 1 - 1
include/igl/embree/bone_visible.cpp

@@ -139,7 +139,7 @@ IGL_INLINE void igl::embree::bone_visible(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 template void igl::embree::bone_visible<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 3, 1, 0, 3, 1>, Eigen::Matrix<bool, -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, 3, 1, 0, 3, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<bool, -1, 1, 0, -1, 1> >&);
 template void igl::embree::bone_visible<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<bool, -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<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<bool, -1, 1, 0, -1, 1> >&);
 #endif

+ 15 - 62
include/igl/embree/unproject_in_mesh.cpp

@@ -7,66 +7,9 @@
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "unproject_in_mesh.h"
 #include "EmbreeIntersector.h"
-#include <igl/unproject.h>
+#include "../unproject.h"
 #include <vector>
 
-#ifndef IGL_OPENGL_4
-template <
-  typename Derivedobj>
-IGL_INLINE int igl::embree::unproject_in_mesh(
-  const double x,
-  const double y,
-  const EmbreeIntersector & ei,
-  Eigen::PlainObjectBase<Derivedobj> & obj)
-{
-  std::vector<igl::embree::Hit> hits;
-  return unproject_in_mesh(x,y,ei,obj,hits);
-}
-
-template <
-  typename Derivedobj>
-IGL_INLINE int igl::embree::unproject_in_mesh(
-  const double x,
-  const double y,
-  const EmbreeIntersector & ei,
-  Eigen::PlainObjectBase<Derivedobj> & obj,
-  std::vector<igl::embree::Hit > & hits)
-{
-  using namespace igl;
-  using namespace std;
-  using namespace Eigen;
-  // Source and direction on screen
-  Vector3f win_s = Vector3f(x,y,0);
-  Vector3f win_d(x,y,1);
-  // Source, destination and direction in world
-  Vector3f s,d,dir;
-  unproject(win_s,s);
-  unproject(win_d,d);
-  dir = d-s;
-  // Shoot ray, collect all hits (could just collect first two)
-  int num_rays_shot;
-  hits.clear();
-  ei.intersectRay(s,dir,hits,num_rays_shot);
-  switch(hits.size())
-  {
-    case 0:
-      break;
-    case 1:
-    {
-      obj = (s + dir*hits[0].t).cast<typename Derivedobj::Scalar>();
-      break;
-    }
-    case 2:
-    default:
-    {
-      obj = 0.5*((s + dir*hits[0].t) + (s + dir*hits[1].t)).cast<typename Derivedobj::Scalar>();
-      break;
-    }
-  }
-  return hits.size();
-}
-#endif
-
 template <typename Derivedobj>
 IGL_INLINE int igl::embree::unproject_in_mesh(
   const Eigen::Vector2f& pos,
@@ -112,12 +55,22 @@ IGL_INLINE int igl::embree::unproject_in_mesh(
   return hits.size();
 }
 
+template <typename Derivedobj>
+IGL_INLINE int igl::embree::unproject_in_mesh(
+    const Eigen::Vector2f& pos,
+    const Eigen::Matrix4f& model,
+    const Eigen::Matrix4f& proj,
+    const Eigen::Vector4f& viewport,
+    const EmbreeIntersector & ei,
+    Eigen::PlainObjectBase<Derivedobj> & obj)
+{
+  std::vector<igl::embree::Hit> hits;
+  return unproject_in_mesh(pos,model,proj,viewport,ei,obj,hits);
+}
+
 
 #ifdef IGL_STATIC_LIBRARY
-#  ifndef IGL_OPENLGL_4
-//template int igl::embree::unproject_in_mesh<Eigen::Matrix<double, 3, 1, 0, 3, 1> >(double, double, igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&, std::vector<igl::embree::Hit, std::allocator<igl::embree::Hit> >&);
-//template int igl::embree::unproject_in_mesh<Eigen::Matrix<double, 3, 1, 0, 3, 1> >(double, double, igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&);
-#  endif
 template int igl::embree::unproject_in_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::Matrix<float, 2, 1, 0, 2, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, std::vector<igl::embree::Hit, std::allocator<igl::embree::Hit> >&);
 template int igl::embree::unproject_in_mesh<Eigen::Matrix<double, 1, 3, 1, 1, 3> >(Eigen::Matrix<float, 2, 1, 0, 2, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&, std::vector<igl::embree::Hit, std::allocator<igl::embree::Hit> >&);
+template int igl::embree::unproject_in_mesh<Eigen::Matrix<double, 3, 1, 0, 3, 1> >(Eigen::Matrix<float, 2, 1, 0, 2, 1> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 4, 0, 4, 4> const&, Eigen::Matrix<float, 4, 1, 0, 4, 1> const&, igl::embree::EmbreeIntersector const&, Eigen::PlainObjectBase<Eigen::Matrix<double, 3, 1, 0, 3, 1> >&);
 #endif

+ 30 - 42
include/igl/embree/unproject_in_mesh.h

@@ -20,62 +20,50 @@ namespace igl
     // Forward define
     class EmbreeIntersector;
   
-    #ifndef IGL_OPENGL_4
     // Unproject a screen location (using current opengl viewport, projection, and
     // model view) to a 3D position _inside_ a given mesh. If the ray through the
     // given screen location (x,y) _hits_ the mesh more than twice then the 3D
     // midpoint between the first two hits is return. If it hits once, then that
     // point is return. If it does not hit the mesh then obj is not set.
     //
+    //
     // Inputs:
-    //    x  x-coordinate of mouse location
-    //    y  y-coordinate of mouse location
-    //    ei  EmbreeIntersector containing (V,F)
+    //    pos        screen space coordinates
+    //    model      model matrix
+    //    proj       projection matrix
+    //    viewport   vieweport vector
+    //    ei         EmbreeIntersector containing (V,F)
     // Outputs:
-    //    obj  3d unprojected mouse point in mesh
+    //    obj        3d unprojected mouse point in mesh
+    //    hits       vector of embree hits
     // Returns number of hits
     //
-    template <
-      typename Derivedobj>
-    IGL_INLINE int unproject_in_mesh(
-      const double x,
-      const double y,
-      const EmbreeIntersector & ei,
-      Eigen::PlainObjectBase<Derivedobj> & obj);
-  
-    template <
-      typename Derivedobj>
+    // Note: Previous prototype did not require model, proj, and viewport. This
+    // has been removed. Instead replace with:
+    //
+    //     Eigen::Matrix4f model,proj;
+    //     Eigen::Vector4f viewport;
+    //     igl::opengl2::model_proj_viewport(model,proj,viewport);
+    //     igl::embree::unproject_in_mesh(Vector2f(x,y),model,proj,viewport,ei,obj,hits);
+    //
+    template < typename Derivedobj>
     IGL_INLINE int unproject_in_mesh(
-      const double x,
-      const double y,
+      const Eigen::Vector2f& pos,
+      const Eigen::Matrix4f& model,
+      const Eigen::Matrix4f& proj,
+      const Eigen::Vector4f& viewport,
       const EmbreeIntersector & ei,
       Eigen::PlainObjectBase<Derivedobj> & obj,
       std::vector<igl::embree::Hit > & hits);
-    #endif
-  
-  // Unproject a screen location (using the given model, proj and viewewport) to a 3D position
-  // and a set of hits
-  //
-  // Inputs:
-  //    pos        screen space coordinates
-  //    model      model matrix
-  //    proj       projection matrix
-  //    viewport   vieweport vector
-  //    ei         EmbreeIntersector containing (V,F)
-  // Outputs:
-  //    obj        3d unprojected mouse point in mesh
-  //    hits       vector of embree hits
-  // Returns number of hits
-  template <
-    typename Derivedobj>
-  IGL_INLINE int unproject_in_mesh(
-    const Eigen::Vector2f& pos,
-    const Eigen::Matrix4f& model,
-    const Eigen::Matrix4f& proj,
-    const Eigen::Vector4f& viewport,
-    const EmbreeIntersector & ei,
-    Eigen::PlainObjectBase<Derivedobj> & obj,
-    std::vector<igl::embree::Hit > & hits);
+    template < typename Derivedobj>
+    IGL_INLINE int unproject_in_mesh(
+      const Eigen::Vector2f& pos,
+      const Eigen::Matrix4f& model,
+      const Eigen::Matrix4f& proj,
+      const Eigen::Vector4f& viewport,
+      const EmbreeIntersector & ei,
+      Eigen::PlainObjectBase<Derivedobj> & obj);
+
   }
 }
 #ifndef IGL_STATIC_LIBRARY

+ 1 - 1
include/igl/embree/unproject_onto_mesh.cpp

@@ -62,5 +62,5 @@ IGL_INLINE bool igl::embree::unproject_onto_mesh(
 
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 #endif

+ 1 - 1
include/igl/fit_rotations.cpp

@@ -217,7 +217,7 @@ IGL_INLINE void igl::fit_rotations_AVX(
 #endif
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 template void igl::fit_rotations<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template void igl::fit_rotations_planar<Eigen::Matrix<double, -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<double, -1, -1, 0, -1, -1> >&);
 template void igl::fit_rotations_planar<Eigen::Matrix<float, -1, -1, 0, -1, -1>, Eigen::Matrix<float, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<float, -1, -1, 0, -1, -1> >&);

+ 3 - 0
include/igl/fit_rotations.h

@@ -12,6 +12,9 @@
 
 namespace igl
 {
+  // Known issues: This seems to be implemented in Eigen/Geometry:
+  // Eigen::umeyama
+  //
   // FIT_ROTATIONS Given an input mesh and new positions find rotations for
   // every covariance matrix in a stack of covariance matrices
   // 

+ 0 - 1
include/igl/flare_textures.h.REMOVED.git-id

@@ -1 +0,0 @@
-3d9ea820d2a9d829dd08bbdb0fe53b38ee19a50c

+ 1 - 1
include/igl/forward_kinematics.cpp

@@ -80,5 +80,5 @@ IGL_INLINE void igl::forward_kinematics(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 #endif

+ 1 - 1
include/igl/group_sum_matrix.cpp

@@ -40,7 +40,7 @@ IGL_INLINE void igl::group_sum_matrix(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 template void igl::group_sum_matrix<double>(Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, int, Eigen::SparseMatrix<double, 0, int>&);
 template void igl::group_sum_matrix<double>(Eigen::Matrix<int, -1, 1, 0, -1, 1> const&, Eigen::SparseMatrix<double, 0, int>&);
 #endif

+ 1 - 1
include/igl/harmonic.cpp

@@ -65,7 +65,7 @@ IGL_INLINE bool igl::harmonic(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 template bool igl::harmonic<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -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<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&); 
 template bool igl::harmonic<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -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<int, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 #endif

+ 0 - 39
include/igl/init_render_to_texture.h

@@ -1,39 +0,0 @@
-// 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
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_INIT_RENDER_TO_TEXTURE_H
-#define IGL_INIT_RENDER_TO_TEXTURE_H
-#include "igl_inline.h"
-#include "OpenGL_convenience.h"
-#include <cstdlib>
-namespace igl
-{
-  #ifndef IGL_NO_OPENGL
-
-  // Create a texture+framebuffer+depthbuffer triplet bound for rendering into
-  // the texture;
-  //
-  // Inputs:
-  //   width  image width
-  //   height image height
-  // Outputs:
-  //   tex_id  id of the texture
-  //   fbo_id  id of the frame buffer object
-  //   dfbo_id  id of the depth frame buffer object
-  IGL_INLINE void init_render_to_texture(
-    const size_t width,
-    const size_t height,
-    GLuint & tex_id,
-    GLuint & fbo_id,
-    GLuint & dfbo_id);
-
-  #endif
-}
-#ifndef IGL_STATIC_LIBRARY
-#  include "init_render_to_texture.cpp"
-#endif
-#endif

+ 0 - 92
include/igl/lens_flare.h

@@ -1,92 +0,0 @@
-// 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 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_LENS_FLARE_H
-#define IGL_LENS_FLARE_H
-
-#ifndef IGL_NO_OPENGL
-#include <igl/OpenGL_convenience.h>
-#include <Eigen/Core>
-#include "igl_inline.h"
-
-#include <vector>
-
-namespace igl
-{
-  struct Flare{
-    int type;             /* flare texture index, 0..5 */
-    float scale;
-    float loc;            /* postion on axis */
-    float color[3];
-    Flare():
-      type(-1),
-      scale(0),
-      loc(0)
-    {}
-    Flare(int type, float location, float scale, const float color[3], float colorScale) :
-      type(type),
-      scale(scale),
-      loc(location)
-    {
-      this->color[0] = color[0] * colorScale;
-      this->color[1] = color[1] * colorScale;
-      this->color[2] = color[2] * colorScale;
-    }
-  };
-  
-  
-  // Initialize shared data for lens flates
-  //
-  // Inputs:
-  //   start_id   starting texture id location (should have at least id:id+16 free)
-  // Outputs:
-  //   shine  list of texture ids for shines
-  //   flare  list of texture ids for flares
-  IGL_INLINE void lens_flare_load_textures(
-    std::vector<GLuint> & shine_ids,
-    std::vector<GLuint> & flare_ids);
-  
-  // Create a set of lens flares
-  //
-  // Inputs:
-  //   A  primary color
-  //   B  secondary color
-  //   C  secondary color
-  // Outputs:
-  //   flares  list of flare objects
-  IGL_INLINE void lens_flare_create(
-    const float * A,
-    const float * B,
-    const float * C,
-    std::vector<Flare> & flares);
-  
-  // Draw lens flares
-  //
-  // Inputs:
-  //   flares  list of Flare objects
-  //   shine_ids  list of shine textures
-  //   flare_ids  list of flare texture ids
-  //   light  position of light
-  //   near_clip  near clipping plane
-  //   shine_tic  current "tic" in shine textures
-  // Outputs:
-  //   shine_tic  current "tic" in shine textures
-  IGL_INLINE void lens_flare_draw(
-    const std::vector<Flare> & flares,
-    const std::vector<GLuint> & shine_ids,
-    const std::vector<GLuint> & flare_ids,
-    const Eigen::Vector3f & light,
-    const float near_clip,
-    int & shine_tic);
-};
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "lens_flare.cpp"
-#endif
-
-#endif
-#endif

+ 1 - 1
include/igl/lim/lim.cpp

@@ -132,5 +132,5 @@ IGL_INLINE int igl::lim(
 }
 
 #ifdef IGL_STATIC_LIBRARY
-// Explicit template instanciation
+// Explicit template specialization
 #endif

+ 2 - 0
include/igl/list_to_matrix.cpp

@@ -167,4 +167,6 @@ template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<d
 template bool igl::list_to_matrix<double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > >(std::vector<double, std::allocator<double> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
 template bool igl::list_to_matrix<int, Eigen::Matrix<int, -1, 2, 0, -1, 2> >(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > const&, Eigen::Matrix<int, -1, 2, 0, -1, 2>&);
 template bool igl::list_to_matrix<unsigned long long int,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,1,0,-1,1> > >(std::vector<unsigned long long int,std::allocator<unsigned long long int> > const &,Eigen::PlainObjectBase<Eigen::Matrix<int,-1,1,0,-1,1> > &);
+template bool igl::list_to_matrix<bool, Eigen::PlainObjectBase<Eigen::Array<bool, -1, 1, 0, -1, 1> > >(std::vector<bool, std::allocator<bool> > const&, Eigen::PlainObjectBase<Eigen::Array<bool, -1, 1, 0, -1, 1> >&);
+template bool igl::list_to_matrix<bool, Eigen::PlainObjectBase<Eigen::Array<bool, -1, -1, 0, -1, -1> > >(std::vector<std::vector<bool, std::allocator<bool> >, std::allocator<std::vector<bool, std::allocator<bool> > > > const&, Eigen::PlainObjectBase<Eigen::Array<bool, -1, -1, 0, -1, -1> >&);
 #endif

+ 0 - 33
include/igl/load_shader.h

@@ -1,33 +0,0 @@
-// 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 
-// obtain one at http://mozilla.org/MPL/2.0/.
-#ifndef IGL_LOAD_SHADER_H 
-#define IGL_LOAD_SHADER_H
-#ifndef IGL_NO_OPENGL
-#include "igl_inline.h" 
-
-#include "OpenGL_convenience.h"
-
-namespace igl
-{
-  // Creates and compiles a shader from a given string
-  // Inputs:
-  //   src  string containing GLSL shader code
-  //   type  GLSL type of shader, one of:
-  //     GL_VERTEX_SHADER
-  //     GL_FRAGMENT_SHADER
-  //     GL_GEOMETRY_SHADER
-  // Returns  index id of the newly created shader, 0 on error
-  IGL_INLINE GLuint load_shader(const char *src,const GLenum type);
-}
-
-#ifndef IGL_STATIC_LIBRARY
-#  include "load_shader.cpp"
-#endif
-
-#endif
-#endif

+ 7 - 6
include/igl/matrix_to_list.cpp

@@ -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/.
 #include "matrix_to_list.h"
 
@@ -11,7 +11,7 @@
 
 template <typename DerivedM>
 IGL_INLINE void igl::matrix_to_list(
-  const Eigen::MatrixBase<DerivedM> & M, 
+  const Eigen::MatrixBase<DerivedM> & M,
   std::vector<std::vector<typename DerivedM::Scalar > > & V)
 {
   using namespace std;
@@ -29,7 +29,7 @@ IGL_INLINE void igl::matrix_to_list(
 
 template <typename DerivedM>
 IGL_INLINE void igl::matrix_to_list(
-  const Eigen::MatrixBase<DerivedM> & M, 
+  const Eigen::MatrixBase<DerivedM> & M,
   std::vector<typename DerivedM::Scalar > & V)
 {
   using namespace std;
@@ -66,4 +66,5 @@ template void igl::matrix_to_list<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen:
 template void igl::matrix_to_list<Eigen::Matrix<double, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, std::vector<Eigen::Matrix<double, -1, 1, 0, -1, 1>::Scalar, std::allocator<Eigen::Matrix<double, -1, 1, 0, -1, 1>::Scalar> >&);
 template void igl::matrix_to_list<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar, std::allocator<Eigen::Matrix<int, -1, -1, 0, -1, -1>::Scalar> >&);
 template void igl::matrix_to_list<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar, std::allocator<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar> >&);
+template void igl::matrix_to_list<Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, std::vector<std::vector<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar, std::allocator<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar> >, std::allocator<std::vector<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar, std::allocator<Eigen::Matrix<int, -1, 1, 0, -1, 1>::Scalar> > > >&);
 #endif

+ 13 - 10
include/igl/min_quad_with_fixed.cpp

@@ -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/.
 #include "min_quad_with_fixed.h"
 
@@ -107,7 +107,7 @@ IGL_INLINE bool igl::min_quad_with_fixed_precompute(
     data.Auu_sym = true;
     // This is an annoying assertion unless EPS can be chosen in a nicer way.
     //assert(is_symmetric(Auu,EPS<double>()));
-    assert(is_symmetric(Auu,1.0) && 
+    assert(is_symmetric(Auu,1.0) &&
       "Auu should be symmetric if positive definite");
   }else
   {
@@ -127,9 +127,9 @@ IGL_INLINE bool igl::min_quad_with_fixed_precompute(
 #endif
     // QR decomposition to determine row rank in Aequ
     slice(Aeq,data.unknown,2,data.Aequ);
-    assert(data.Aequ.rows() == neq && 
+    assert(data.Aequ.rows() == neq &&
       "#Rows in Aequ should match #constraints");
-    assert(data.Aequ.cols() == data.unknown.size() && 
+    assert(data.Aequ.cols() == data.unknown.size() &&
       "#cols in Aequ should match #unknowns");
     data.AeqTQR.compute(data.Aequ.transpose().eval());
 #ifdef MIN_QUAD_WITH_FIXED_CPP_DEBUG
@@ -150,7 +150,7 @@ IGL_INLINE bool igl::min_quad_with_fixed_precompute(
         return false;
     }
     nc = data.AeqTQR.rank();
-    assert(nc<=neq && 
+    assert(nc<=neq &&
       "Rank of reduced constraints should be <= #original constraints");
     data.Aeq_li = nc == neq;
     //cout<<"data.Aeq_li: "<<data.Aeq_li<<endl;
@@ -467,7 +467,7 @@ IGL_INLINE bool igl::min_quad_with_fixed_solve(
     assert(data.solver_type == min_quad_with_fixed_data<T>::QR_LLT);
     PlainObjectBase<DerivedBeq> eff_Beq;
     // Adjust Aeq rhs to include known parts
-    eff_Beq = 
+    eff_Beq =
       //data.AeqTQR.colsPermutation().transpose() * (-data.Aeqk * Y + Beq);
       data.AeqTET * (-data.Aeqk * Y + Beq);
     // Where did this -0.5 come from? Probably the same place as above.
@@ -571,5 +571,8 @@ template bool igl::min_quad_with_fixed_solve<double, Eigen::Matrix<double, -1, 1
 template bool igl::min_quad_with_fixed_precompute<double, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> > const&, Eigen::SparseMatrix<double, 0, int> const&, bool, igl::min_quad_with_fixed_data<double>&);
 template bool igl::min_quad_with_fixed_solve<double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(igl::min_quad_with_fixed_data<double> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 template bool igl::min_quad_with_fixed_solve<double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(igl::min_quad_with_fixed_data<double> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template bool igl::min_quad_with_fixed_solve<double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(igl::min_quad_with_fixed_data<double> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> >&);
+template  bool igl::min_quad_with_fixed_solve<double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(igl::min_quad_with_fixed_data<double> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template bool igl::min_quad_with_fixed_solve<double, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(igl::min_quad_with_fixed_data<double> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
+template bool igl::min_quad_with_fixed<double, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::SparseMatrix<double, 0, int> const&, 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::SparseMatrix<double, 0, int> const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, bool, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
 #endif
-

+ 1 - 1
include/igl/mvc.cpp

@@ -153,7 +153,7 @@ IGL_INLINE void igl::mvc(const Eigen::MatrixXd &V, const Eigen::MatrixXd &C, Eig
         // handled that)
         // domain vertex j is on the segment from i to i+1 if the distances from vj to
         // pi and pi+1 are about 
-        if(abs((dist_C_V(i,j) + dist_C_V_next) / edge_length - 1) < EPS)
+        if(std::abs((dist_C_V(i,j) + dist_C_V_next) / edge_length - 1) < EPS)
           on_segment.push_back(std::make_pair(j,i));
       
     }

+ 17 - 13
include/igl/normal_derivative.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 "normal_derivative.h"
 #include "cotmatrix_entries.h"
@@ -11,8 +11,8 @@
 #include <cassert>
 
 template <
-  typename DerivedV, 
-  typename DerivedEle, 
+  typename DerivedV,
+  typename DerivedEle,
   typename Scalar>
 IGL_INLINE void igl::normal_derivative(
   const Eigen::PlainObjectBase<DerivedV> & V,
@@ -21,7 +21,7 @@ IGL_INLINE void igl::normal_derivative(
 {
   using namespace Eigen;
   using namespace std;
-  // Element simplex-size 
+  // Element simplex-size
   const size_t ss = Ele.cols();
   assert( ((ss==3) || (ss==4)) && "Only triangles or tets");
   // cotangents
@@ -39,7 +39,7 @@ IGL_INLINE void igl::normal_derivative(
       return;
     case 4:
     {
-      const MatrixXi DDJ = 
+      const MatrixXi DDJ =
         slice(
           Ele,
           (VectorXi(24)<<
@@ -54,9 +54,9 @@ IGL_INLINE void igl::normal_derivative(
           DDI.col(f*6+r) = I;
         }
       }
-      const DiagonalMatrix<Scalar,24,24> S = 
+      const DiagonalMatrix<Scalar,24,24> S =
         (Matrix<Scalar,2,1>(1,-1).template replicate<12,1>()).asDiagonal();
-      Matrix<Scalar,Dynamic,Dynamic> DDV = 
+      Matrix<Scalar,Dynamic,Dynamic> DDV =
         slice(
           C,
           (VectorXi(24)<<
@@ -78,7 +78,7 @@ IGL_INLINE void igl::normal_derivative(
     }
     case 3:
     {
-      const MatrixXi DDJ = 
+      const MatrixXi DDJ =
         slice(Ele,(VectorXi(12)<<2,0,1,0,0,1,2,1,1,2,0,2).finished(),2);
       MatrixXi DDI(m,12);
       for(size_t f = 0;f<3;f++)
@@ -89,9 +89,9 @@ IGL_INLINE void igl::normal_derivative(
           DDI.col(f*4+r) = I;
         }
       }
-      const DiagonalMatrix<Scalar,12,12> S = 
+      const DiagonalMatrix<Scalar,12,12> S =
         (Matrix<Scalar,2,1>(1,-1).template replicate<6,1>()).asDiagonal();
-      Matrix<Scalar,Dynamic,Dynamic> DDV = 
+      Matrix<Scalar,Dynamic,Dynamic> DDV =
         slice(C,(VectorXi(12)<<1,1,2,2,2,2,0,0,0,0,1,1).finished(),2);
       DDV *= S;
 
@@ -111,3 +111,7 @@ IGL_INLINE void igl::normal_derivative(
 
 }
 
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template specialization
+template void igl::normal_derivative<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, double>(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::SparseMatrix<double, 0, int>&);
+#endif

+ 5 - 6
include/igl/on_boundary.cpp

@@ -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/.
 #include "on_boundary.h"
 
@@ -137,6 +137,5 @@ IGL_INLINE void igl::on_boundary(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 template void igl::on_boundary<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
+template void igl::on_boundary<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Array<bool, -1, 1, 0, -1, 1>, Eigen::Array<bool, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Array<bool, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Array<bool, -1, -1, 0, -1, -1> >&);
 #endif
-
-

+ 2 - 5
include/igl/OpenGL_convenience.h → include/igl/opengl/OpenGL_convenience.h

@@ -5,9 +5,8 @@
 // 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_OPENGL_CONVENIENCE_H
-#define IGL_OPENGL_CONVENIENCE_H
-#ifndef IGL_NO_OPENGL
+#ifndef IGL_OPENGL_OPENGL_CONVENIENCE_H
+#define IGL_OPENGL_OPENGL_CONVENIENCE_H
 
 // Always use this:
 //     #include "OpenGL_convenience.h"
@@ -33,5 +32,3 @@
 #endif
 
 #endif
-#endif
-

+ 4 - 6
include/igl/compile_and_link_program.cpp → include/igl/opengl/compile_and_link_program.cpp

@@ -11,9 +11,8 @@
 #include <iostream>
 #include <cassert>
 
-#ifndef IGL_NO_OPENGL
 
-IGL_INLINE GLuint igl::compile_and_link_program(
+IGL_INLINE GLuint igl::opengl::compile_and_link_program(
   const char * v_str, const char * f_str)
 {
   GLuint vid = compile_shader(GL_VERTEX_SHADER,v_str);
@@ -22,12 +21,12 @@ IGL_INLINE GLuint igl::compile_and_link_program(
   GLuint prog_id = glCreateProgram();
   assert(prog_id != 0 && "Failed to create shader.");
   glAttachShader(prog_id,vid);
-  igl::report_gl_error("glAttachShader (vid): ");
+  report_gl_error("glAttachShader (vid): ");
   glAttachShader(prog_id,fid);
-  igl::report_gl_error("glAttachShader (fid): ");
+  report_gl_error("glAttachShader (fid): ");
 
   glLinkProgram(prog_id);
-  igl::report_gl_error("glLinkProgram: ");
+  report_gl_error("glLinkProgram: ");
 
   GLint status;
   glGetProgramiv(prog_id, GL_LINK_STATUS, &status);
@@ -41,4 +40,3 @@ IGL_INLINE GLuint igl::compile_and_link_program(
   return prog_id;
 }
 
-#endif

+ 32 - 0
include/igl/opengl/compile_and_link_program.h

@@ -0,0 +1,32 @@
+// 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
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_OPENGL_COMPILE_AND_LINK_PROGRAM_H
+#define IGL_OPENGL_COMPILE_AND_LINK_PROGRAM_H
+#include "../igl_inline.h"
+#include "OpenGL_convenience.h"
+namespace igl
+{
+  namespace opengl
+  {
+    // Compile and link very simple vertex/fragment shaders
+    //
+    // Inputs:
+    //   v_str  string of vertex shader contents
+    //   f_str  string of fragment shader contents
+    // Returns id of program
+    //
+    // Known bugs: this seems to duplicate `create_shader_program` with less
+    // functionality.
+    IGL_INLINE GLuint compile_and_link_program(
+      const char * v_str, const char * f_str);
+  }
+}
+#ifndef IGL_STATIC_LIBRARY
+#  include "compile_and_link_program.cpp"
+#endif
+#endif

+ 4 - 8
include/igl/compile_shader.cpp → include/igl/opengl/compile_shader.cpp

@@ -9,16 +9,14 @@
 #include "report_gl_error.h"
 #include <iostream>
 
-#ifndef IGL_NO_OPENGL
-
-IGL_INLINE GLuint igl::compile_shader(const GLint type, const char * str)
+IGL_INLINE GLuint igl::opengl::compile_shader(const GLint type, const char * str)
 {
   GLuint id = glCreateShader(type);
-  igl::report_gl_error("glCreateShader: ");
+  report_gl_error("glCreateShader: ");
   glShaderSource(id,1,&str,NULL);
-  igl::report_gl_error("glShaderSource: ");
+  report_gl_error("glShaderSource: ");
   glCompileShader(id);
-  igl::report_gl_error("glCompileShader: ");
+  report_gl_error("glCompileShader: ");
 
   GLint status;
   glGetShaderiv(id, GL_COMPILE_STATUS, &status);
@@ -35,5 +33,3 @@ IGL_INLINE GLuint igl::compile_shader(const GLint type, const char * str)
   }
   return id;
 }
-
-#endif

+ 38 - 0
include/igl/opengl/compile_shader.h

@@ -0,0 +1,38 @@
+// 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
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_OPENGL_COMPILE_SHADER_H
+#define IGL_OPENGL_COMPILE_SHADER_H
+#include "OpenGL_convenience.h"
+#include "../igl_inline.h"
+namespace igl
+{
+  namespace 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
+    // Returns result of glCreateShader (id of shader)
+    //
+    // Example:
+    //     GLuint vid = compile_shader(GL_VERTEX_SHADER,vertex_shader.c_str());
+    //     GLuint fid = compile_shader(GL_FRAGMENT_SHADER,fragment_shader.c_str());
+    //     GLuint prog_id = glCreateProgram();
+    //     glAttachShader(prog_id,vid);
+    //     glAttachShader(prog_id,fid);
+    //     glLinkProgram(prog_id);
+    //
+    // Known bugs: seems to be duplicate of `load_shader`
+    IGL_INLINE GLuint compile_shader(const GLint type, const char * str);
+  }
+}
+#ifndef IGL_STATIC_LIBRARY
+#  include "compile_shader.cpp"
+#endif
+#endif

+ 1 - 3
include/igl/create_index_vbo.cpp → include/igl/opengl/create_index_vbo.cpp

@@ -7,9 +7,8 @@
 // obtain one at http://mozilla.org/MPL/2.0/.
 #include "create_index_vbo.h"
 
-#ifndef IGL_NO_OPENGL
 // http://www.songho.ca/opengl/gl_vbo.html#create
-IGL_INLINE void igl::create_index_vbo(
+IGL_INLINE void igl::opengl::create_index_vbo(
   const Eigen::MatrixXi & F,
   GLuint & F_vbo_id)
 {
@@ -41,7 +40,6 @@ IGL_INLINE void igl::create_index_vbo(
   // bind with 0, so, switch back to normal pointer operation
   glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
 }
-#endif
 
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization

+ 14 - 15
include/igl/create_index_vbo.h → include/igl/opengl/create_index_vbo.h

@@ -5,29 +5,29 @@
 // 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_CREATE_INDEX_VBO_H
-#define IGL_CREATE_INDEX_VBO_H
-#ifndef IGL_NO_OPENGL
-#include "igl_inline.h"
+#ifndef IGL_OPENGL_CREATE_INDEX_VBO_H
+#define IGL_OPENGL_CREATE_INDEX_VBO_H
+#include "../igl_inline.h"
 // NOTE: It wouldn't be so hard to template this using Eigen's templates
 
 #include <Eigen/Core>
-
 #include "OpenGL_convenience.h"
 
 // Create a VBO (Vertex Buffer Object) for a list of indices:
 // GL_ELEMENT_ARRAY_BUFFER_ARB for the triangle indices (F)
 namespace igl
 {
-
-  // Inputs:
-  //   F  #F by 3 eigen Matrix of face (triangle) indices
-  // Outputs:
-  //   F_vbo_id  buffer id for face indices
-  //
-  IGL_INLINE void create_index_vbo(
-    const Eigen::MatrixXi & F,
-    GLuint & F_vbo_id);
+  namespace opengl
+  {
+    // Inputs:
+    //   F  #F by 3 eigen Matrix of face (triangle) indices
+    // Outputs:
+    //   F_vbo_id  buffer id for face indices
+    //
+    IGL_INLINE void create_index_vbo(
+      const Eigen::MatrixXi & F,
+      GLuint & F_vbo_id);
+  }
 }
 
 #ifndef IGL_STATIC_LIBRARY
@@ -35,4 +35,3 @@ namespace igl
 #endif
 
 #endif
-#endif

+ 2 - 4
include/igl/create_mesh_vbo.cpp → include/igl/opengl/create_mesh_vbo.cpp

@@ -6,13 +6,12 @@
 // 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 "create_mesh_vbo.h"
-#ifndef IGL_NO_OPENGL
 
 #include "create_vector_vbo.h"
 #include "create_index_vbo.h"
 
 // http://www.songho.ca/opengl/gl_vbo.html#create
-IGL_INLINE void igl::create_mesh_vbo(
+IGL_INLINE void igl::opengl::create_mesh_vbo(
   const Eigen::MatrixXd & V,
   const Eigen::MatrixXi & F,
   GLuint & V_vbo_id,
@@ -25,7 +24,7 @@ IGL_INLINE void igl::create_mesh_vbo(
 }
 
 // http://www.songho.ca/opengl/gl_vbo.html#create
-IGL_INLINE void igl::create_mesh_vbo(
+IGL_INLINE void igl::opengl::create_mesh_vbo(
   const Eigen::MatrixXd & V,
   const Eigen::MatrixXi & F,
   const Eigen::MatrixXd & N,
@@ -42,4 +41,3 @@ IGL_INLINE void igl::create_mesh_vbo(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 #endif
-#endif

+ 64 - 0
include/igl/opengl/create_mesh_vbo.h

@@ -0,0 +1,64 @@
+// 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_OPENGL_CREATE_MESH_VBO_H
+#define IGL_OPENGL_CREATE_MESH_VBO_H
+#include "../igl_inline.h"
+// NOTE: It wouldn't be so hard to template this using Eigen's templates
+
+#include <Eigen/Core>
+
+#include "OpenGL_convenience.h"
+
+// Create a VBO (Vertex Buffer Object) for a mesh. Actually two VBOs: one 
+// GL_ARRAY_BUFFER for the vertex positions (V) and one
+// GL_ELEMENT_ARRAY_BUFFER for the triangle indices (F)
+namespace igl
+{
+  namespace opengl
+  {
+  
+    // Inputs:
+    //   V  #V by 3 eigen Matrix of mesh vertex 3D positions
+    //   F  #F by 3 eigne Matrix of face (triangle) indices
+    // Outputs:
+    //   V_vbo_id  buffer id for vertex positions
+    //   F_vbo_id  buffer id for face indices
+    //
+    // NOTE: when using glDrawElements VBOs for V and F using MatrixXd and
+    // MatrixXi will have types GL_DOUBLE and GL_UNSIGNED_INT respectively
+    //
+    IGL_INLINE void create_mesh_vbo(
+      const Eigen::MatrixXd & V,
+      const Eigen::MatrixXi & F,
+      GLuint & V_vbo_id,
+      GLuint & F_vbo_id);
+  
+    // Inputs:
+    //   V  #V by 3 eigen Matrix of mesh vertex 3D positions
+    //   F  #F by 3 eigne Matrix of face (triangle) indices
+    //   N  #V by 3 eigen Matrix of mesh vertex 3D normals
+    // Outputs:
+    //   V_vbo_id  buffer id for vertex positions
+    //   F_vbo_id  buffer id for face indices
+    //   N_vbo_id  buffer id for vertex positions
+    IGL_INLINE void create_mesh_vbo(
+      const Eigen::MatrixXd & V,
+      const Eigen::MatrixXi & F,
+      const Eigen::MatrixXd & N,
+      GLuint & V_vbo_id,
+      GLuint & F_vbo_id,
+      GLuint & N_vbo_id);
+  }
+
+}
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "create_mesh_vbo.cpp"
+#endif
+
+#endif

+ 11 - 9
include/igl/create_shader_program.cpp → include/igl/opengl/create_shader_program.cpp

@@ -6,14 +6,13 @@
 // 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 "create_shader_program.h"
-#ifndef IGL_NO_OPENGL
 
 #include "load_shader.h"
 #include "print_program_info_log.h"
 #include <iostream>
 #include <cstdio>
 
-IGL_INLINE bool igl::create_shader_program(
+IGL_INLINE bool igl::opengl::create_shader_program(
   const std::string & geom_source,
   const std::string & vert_source,
   const std::string & frag_source,
@@ -40,7 +39,7 @@ IGL_INLINE bool igl::create_shader_program(
   if(geom_source != "")
   {
     // load vertex shader
-    GLuint g = igl::load_shader(geom_source.c_str(),GL_GEOMETRY_SHADER_EXT);
+    GLuint g = igl::opengl::load_shader(geom_source.c_str(),GL_GEOMETRY_SHADER_EXT);
     if(g == 0)
     {
       cerr<<"geometry shader failed to compile."<<endl;
@@ -52,7 +51,7 @@ IGL_INLINE bool igl::create_shader_program(
   if(vert_source != "")
   {
     // load vertex shader
-    GLuint v = igl::load_shader(vert_source.c_str(),GL_VERTEX_SHADER);
+    GLuint v = igl::opengl::load_shader(vert_source.c_str(),GL_VERTEX_SHADER);
     if(v == 0)
     {
       cerr<<"vertex shader failed to compile."<<endl;
@@ -64,7 +63,7 @@ IGL_INLINE bool igl::create_shader_program(
   if(frag_source != "")
   {
     // load fragment shader
-    GLuint f = igl::load_shader(frag_source.c_str(),GL_FRAGMENT_SHADER);
+    GLuint f = igl::opengl::load_shader(frag_source.c_str(),GL_FRAGMENT_SHADER);
     if(f == 0)
     {
       cerr<<"fragment shader failed to compile."<<endl;
@@ -88,12 +87,12 @@ IGL_INLINE bool igl::create_shader_program(
   glLinkProgram(id);
 
   // print log if any
-  igl::print_program_info_log(id);
+  igl::opengl::print_program_info_log(id);
 
   return true;
 }
 
-IGL_INLINE bool igl::create_shader_program(
+IGL_INLINE bool igl::opengl::create_shader_program(
   const std::string & vert_source,
   const std::string & frag_source,
   const std::map<std::string,GLuint> & attrib,
@@ -103,7 +102,7 @@ IGL_INLINE bool igl::create_shader_program(
 }
 
 
-IGL_INLINE GLuint igl::create_shader_program(
+IGL_INLINE GLuint igl::opengl::create_shader_program(
   const std::string & geom_source,
   const std::string & vert_source,
   const std::string & frag_source,
@@ -114,7 +113,7 @@ IGL_INLINE GLuint igl::create_shader_program(
   return prog_id;
 }
 
-IGL_INLINE GLuint igl::create_shader_program(
+IGL_INLINE GLuint igl::opengl::create_shader_program(
   const std::string & vert_source,
   const std::string & frag_source,
   const std::map<std::string,GLuint> & attrib)
@@ -124,4 +123,7 @@ IGL_INLINE GLuint igl::create_shader_program(
   return prog_id;
 }
 
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template specialization
 #endif
+

+ 66 - 0
include/igl/opengl/create_shader_program.h

@@ -0,0 +1,66 @@
+// 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 
+// obtain one at http://mozilla.org/MPL/2.0/.
+#ifndef IGL_OPENGL_CREATE_SHADER_PROGRAM_H
+#define IGL_OPENGL_CREATE_SHADER_PROGRAM_H
+
+#include "../igl_inline.h"
+#include <string>
+#include <map>
+
+#include "OpenGL_convenience.h"
+
+namespace igl
+{
+  namespace opengl
+  {
+    // Create a shader program with a vertex and fragments shader loading from
+    // source strings and vertex attributes assigned from a map before linking the
+    // shaders to the program, making it ready to use with glUseProgram(id)
+    // Inputs:
+    //   geom_source  string containing source code of geometry shader (can be
+    //     "" to mean use default pass-through)
+    //   vert_source  string containing source code of vertex shader
+    //   frag_source  string containing source code of fragment shader
+    //   attrib  map containing table of vertex attribute strings add their
+    //   correspondingly ids (generated previously using glBindAttribLocation)
+    // Outputs:
+    //   id  index id of created shader, set to 0 on error
+    // Returns true on success, false on error
+    //
+    // Note: Caller is responsible for making sure that current value of id is not
+    // leaking a shader (since it will be overwritten)
+    //
+    // See also: destroy_shader_program
+    IGL_INLINE bool create_shader_program(
+      const std::string &geom_source,
+      const std::string &vert_source,
+      const std::string &frag_source,
+      const std::map<std::string,GLuint> &attrib,
+      GLuint & id);
+    IGL_INLINE bool create_shader_program(
+      const std::string &vert_source,
+      const std::string &frag_source,
+      const std::map<std::string,GLuint> &attrib,
+      GLuint & id);
+    IGL_INLINE GLuint create_shader_program(
+      const std::string & geom_source,
+      const std::string & vert_source,
+      const std::string & frag_source,
+      const std::map<std::string,GLuint> &attrib);
+    IGL_INLINE GLuint create_shader_program(
+      const std::string & vert_source,
+      const std::string & frag_source,
+      const std::map<std::string,GLuint> &attrib);
+  }
+}
+
+#ifndef IGL_STATIC_LIBRARY
+#  include "create_shader_program.cpp"
+#endif
+
+#endif

+ 3 - 5
include/igl/create_vector_vbo.cpp → include/igl/opengl/create_vector_vbo.cpp

@@ -6,13 +6,12 @@
 // 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 "create_vector_vbo.h"
-#ifndef IGL_NO_OPENGL
 
 #include <cassert>
 
 // http://www.songho.ca/opengl/gl_vbo.html#create
 template <typename T>
-IGL_INLINE void igl::create_vector_vbo(
+IGL_INLINE void igl::opengl::create_vector_vbo(
   const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> & V,
   GLuint & V_vbo_id)
 {
@@ -51,9 +50,8 @@ IGL_INLINE void igl::create_vector_vbo(
 #ifdef IGL_STATIC_LIBRARY
 // Explicit template specialization
 // generated by autoexplicit.sh
-template void igl::create_vector_vbo<int>(Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, unsigned int&);
+template void igl::opengl::create_vector_vbo<int>(Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, unsigned int&);
 // generated by autoexplicit.sh
-template void igl::create_vector_vbo<double>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, unsigned int&);
+template void igl::opengl::create_vector_vbo<double>(Eigen::Matrix<double, -1, -1, 0, -1, -1> const&, unsigned int&);
 #endif
 
-#endif

+ 17 - 17
include/igl/create_vector_vbo.h → include/igl/opengl/create_vector_vbo.h

@@ -5,10 +5,9 @@
 // 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_CREATE_VECTOR_VBO_H
-#define IGL_CREATE_VECTOR_VBO_H
-#ifndef IGL_NO_OPENGL
-#include "igl_inline.h"
+#ifndef IGL_OPENGL_CREATE_VECTOR_VBO_H
+#define IGL_OPENGL_CREATE_VECTOR_VBO_H
+#include "../igl_inline.h"
 // NOTE: It wouldn't be so hard to template this using Eigen's templates
 
 #include <Eigen/Core>
@@ -19,18 +18,20 @@
 // GL_ARRAY_BUFFER for the vectors (V)
 namespace igl
 {
-
-  // Templates:
-  //   T  should be a eigen matrix primitive type like int or double
-  // Inputs:
-  //   V  m by n eigen Matrix of type T values
-  // Outputs:
-  //   V_vbo_id  buffer id for vectors
-  //
-  template <typename T>
-  IGL_INLINE void create_vector_vbo(
-    const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> & V,
-    GLuint & V_vbo_id);
+  namespace opengl
+  {
+    // Templates:
+    //   T  should be a eigen matrix primitive type like int or double
+    // Inputs:
+    //   V  m by n eigen Matrix of type T values
+    // Outputs:
+    //   V_vbo_id  buffer id for vectors
+    //
+    template <typename T>
+    IGL_INLINE void create_vector_vbo(
+      const Eigen::Matrix<T,Eigen::Dynamic,Eigen::Dynamic> & V,
+      GLuint & V_vbo_id);
+  }
 }
 
 #ifndef IGL_STATIC_LIBRARY
@@ -38,4 +39,3 @@ namespace igl
 #endif
 
 #endif
-#endif

+ 6 - 3
include/igl/destroy_shader_program.cpp → include/igl/opengl/destroy_shader_program.cpp

@@ -6,11 +6,10 @@
 // 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 "destroy_shader_program.h"
-#ifndef IGL_NO_OPENGL
 #include <cstdio>
 #include "report_gl_error.h"
 
-IGL_INLINE bool igl::destroy_shader_program(const GLuint id)
+IGL_INLINE bool igl::opengl::destroy_shader_program(const GLuint id)
 {
   // Don't try to destroy id == 0 (no shader program)
   if(id == 0)
@@ -27,7 +26,7 @@ IGL_INLINE bool igl::destroy_shader_program(const GLuint id)
   {
     // Try to get at most *1* attached shader
     glGetAttachedShaders(id,1,&count,&s);
-    GLenum err = igl::report_gl_error();
+    GLenum err = igl::opengl::report_gl_error();
     if (GL_NO_ERROR != err)
     {
       return false;
@@ -44,4 +43,8 @@ IGL_INLINE bool igl::destroy_shader_program(const GLuint id)
   glDeleteProgram(id);
   return true;
 }
+
+#ifdef IGL_STATIC_LIBRARY
+// Explicit template specialization
 #endif
+

Some files were not shown because too many files changed in this diff