Bladeren bron

embree example

Former-commit-id: 8f9e374ed6d433937ee19bc0ebf84d8968824774
Alec Jacobson (jalec 11 jaren geleden
bovenliggende
commit
34e06d6beb

+ 33 - 0
examples/embree/Makefile

@@ -0,0 +1,33 @@
+
+.PHONY: all
+
+# Shared flags etc.
+include ../../Makefile.conf
+
+all: example
+
+.PHONY: example
+
+LIBIGL=../../
+LIBIGL_INC=-I$(LIBIGL)/include
+LIBIGL_LIB=-L$(LIBIGL)/lib -ligl -liglembree
+
+EIGEN3_INC=-I/opt/local/include/eigen3 -I/opt/local/include/eigen3/unsupported
+
+EMBREE=$(LIBIGL)/external/embree
+EMBREE_INC=-I$(EMBREE)/rtcore -I$(EMBREE)/common
+EMBREE_LIB=-L$(EMBREE)/bin -lrtcore -lsys
+
+ANTTWEAKBAR_INC=-I$(LIBIGL)/external/AntTweakBar/include
+ANTTWEAKBAR_LIB=-L$(LIBIGL)/external/AntTweakBar/lib -lAntTweakBar -framework AppKit
+INC=$(LIBIGL_INC) $(ANTTWEAKBAR_INC) $(EIGEN3_INC) $(EMBREE_INC)
+LIB=$(OPENGL_LIB) $(GLUT_LIB) $(ANTTWEAKBAR_LIB) $(LIBIGL_LIB) $(EMBREE_LIB)
+
+example: example.o
+	g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -o example example.o $(LIB)
+
+example.o: example.cpp
+	g++ $(OPENMP) $(AFLAGS) $(CFLAGS) -c example.cpp -o example.o $(INC)
+clean:
+	rm -f example.o
+	rm -f example

+ 236 - 0
examples/embree/example.cpp

@@ -0,0 +1,236 @@
+#include <igl/OpenGL_convenience.h>
+#include <igl/per_face_normals.h>
+#include <igl/read.h>
+#include <igl/normalize_row_lengths.h>
+#include <igl/draw_mesh.h>
+#include <igl/draw_floor.h>
+#include <igl/unproject.h>
+#include <igl/quat_to_mat.h>
+#include <igl/embree/EmbreeIntersector.h>
+
+#ifdef __APPLE__
+#  include <GLUT/glut.h>
+#else
+#  include <GL/glut.h>
+#endif
+#include <Eigen/Core>
+
+#include <iostream>
+
+int width,height;
+float scene_rot[4] = {0,0,0,1};
+float light_pos[4] = {0.1,0.1,-0.9,0};
+Eigen::MatrixXd V,N,C,mean;
+double bbd;
+Eigen::MatrixXi F;
+igl::EmbreeIntersector<Eigen::MatrixXd,Eigen::MatrixXi,Eigen::Vector3d> ei;
+// Ray
+Eigen::Vector3d s,d,dir;
+
+void reshape(int width,int height)
+{
+  using namespace std;
+  ::width = width;
+  ::height = height;
+  glMatrixMode(GL_PROJECTION);
+  glLoadIdentity();
+  glViewport(0,0,width,height);
+}
+
+void lights()
+{
+  using namespace std;
+  glEnable(GL_LIGHTING);
+  glLightModelf(GL_LIGHT_MODEL_TWO_SIDE,GL_TRUE);
+  glEnable(GL_LIGHT0);
+  glEnable(GL_LIGHT1);
+  float ones[4] = {1.0,1.0,1.0,1.0};
+  float zeros[4] = {0.0,0.0,0.0,0.0};
+  float pos[4];
+  copy(light_pos,light_pos+4,pos);
+  glLightfv(GL_LIGHT0,GL_AMBIENT,zeros);
+  glLightfv(GL_LIGHT0,GL_DIFFUSE,ones);
+  glLightfv(GL_LIGHT0,GL_SPECULAR,zeros);
+  glLightfv(GL_LIGHT0,GL_POSITION,pos);
+  pos[0] *= -1;
+  pos[1] *= -1;
+  pos[2] *= -1;
+  glLightfv(GL_LIGHT1,GL_AMBIENT,zeros);
+  glLightfv(GL_LIGHT1,GL_DIFFUSE,ones);
+  glLightfv(GL_LIGHT1,GL_SPECULAR,zeros);
+  glLightfv(GL_LIGHT1,GL_POSITION,pos);
+}
+
+void push_scene()
+{
+  using namespace igl;
+  //gluOrtho2D(0,width,0,height);
+  gluPerspective(45,(double)width/(double)height,1e-2,100);
+  glMatrixMode(GL_MODELVIEW);
+  glLoadIdentity();
+  gluLookAt(0,0,3,0,0,0,0,1,0);
+  glPushMatrix();
+  float mat[4*4];
+  quat_to_mat(scene_rot,mat);
+  glMultMatrixf(mat);
+}
+
+void push_object()
+{
+  glPushMatrix();
+  glScaled(2./bbd,2./bbd,2./bbd);
+  glTranslated(-mean(0,0),-mean(0,1),-mean(0,2));
+}
+
+void pop_scene()
+{
+  glPopMatrix();
+}
+
+void pop_object()
+{
+  glPopMatrix();
+}
+
+const float back[4] = {190.0/255.0,190.0/255.0,190.0/255.0,0};
+void display()
+{
+  using namespace Eigen;
+  using namespace igl;
+  glClearColor(back[0],back[1],back[2],0);
+  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+  lights();
+  push_scene();
+
+  glEnable(GL_DEPTH_TEST);
+  glEnable(GL_NORMALIZE);
+  glEnable(GL_COLOR_MATERIAL);
+  glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
+  //glColorMaterial(GL_FRONT, GL_DIFFUSE);
+  //glColorMaterial(GL_FRONT, GL_AMBIENT);
+  //glColorMaterial(GL_FRONT, GL_SPECULAR);
+
+
+  push_object();
+  draw_mesh(V,F,N,C);
+
+  glDisable(GL_COLOR_MATERIAL);
+  glDisable(GL_LIGHTING);
+  glBegin(GL_POINTS);
+  glColor3f(1,0,0);
+  glVertex3dv(s.data());
+  glColor3f(0,0,1);
+  glVertex3dv(d.data());
+  glEnd();
+  Vector3d n,f;
+  n = s+1000.0*dir;
+  f = d-1000.0*dir;
+  glBegin(GL_LINE);
+  glColor3f(1,0,0);
+  glVertex3dv(n.data());
+  glColor3f(1,0,0);
+  glVertex3dv(f.data());
+  glEnd();
+
+  pop_object();
+
+  glPushMatrix();
+  glEnable(GL_LIGHTING);
+  glTranslated(0,-1,0);
+  draw_floor();
+  glPopMatrix();
+
+  pop_scene();
+
+  glutSwapBuffers();
+  glutPostRedisplay();
+}
+
+void init_C()
+{
+  C.col(0).setConstant(0.4);
+  C.col(1).setConstant(0.8);
+  C.col(2).setConstant(0.3);
+}
+
+void mouse_move(int mouse_x, int mouse_y)
+{
+  using namespace std;
+  using namespace Eigen;
+  using namespace igl;
+  init_C();
+  push_scene();
+  push_object();
+  Vector3d win_s(mouse_x,height-mouse_y,0);
+  Vector3d win_d(mouse_x,height-mouse_y,1);
+  unproject(win_s,s);
+  unproject(win_d,d);
+  dir = d-s;
+  embree::Hit hit;
+  if(ei.intersectRay(s,d,hit))
+  {
+    cout<<"hit!"<<endl;
+    C(hit.id0 % F.rows(),0) = 1;
+    C(hit.id0 % F.rows(),1) = 0.4;
+    C(hit.id0 % F.rows(),2) = 0.4;
+  }
+  pop_object();
+  pop_scene();
+}
+
+
+void key(unsigned char key, int mouse_x, int mouse_y)
+{
+  using namespace std;
+  switch(key)
+  {
+    case char(27):
+      exit(0);
+    default:
+      cout<<"Unknown key command: "<<key<<" "<<int(key)<<endl;
+  }
+  
+}
+
+int main(int argc, char * argv[])
+{
+  using namespace Eigen;
+  using namespace igl;
+  using namespace std;
+
+  // init mesh
+  if(!read("../shared/cheburashka.obj",V,F))
+  {
+    return 1;
+  }
+  per_face_normals(V,F,N);
+  mean = V.colwise().mean();
+  C.resize(F.rows(),3);
+  init_C();
+  bbd = 
+    (V.colwise().maxCoeff() -
+    V.colwise().minCoeff()).maxCoeff();
+  normalize_row_lengths(N,N);
+
+  // Init embree
+  cout<<"Flipping faces..."<<endl;
+  MatrixXi FF;
+  FF.resize(F.rows()*2,F.cols());
+  FF << F, F.rowwise().reverse().eval();
+  cout<<"Initializing Embree..."<<endl;
+  ei = EmbreeIntersector<MatrixXd,MatrixXi,Vector3d>(V,FF);
+
+  // Init glut
+  glutInit(&argc,argv);
+  glutInitDisplayString( "rgba depth double samples>=8 ");
+  glutInitWindowSize(glutGet(GLUT_SCREEN_WIDTH),glutGet(GLUT_SCREEN_HEIGHT));
+  glutInitWindowSize(450,300);
+  glutCreateWindow("embree");
+  glutDisplayFunc(display);
+  glutReshapeFunc(reshape);
+  glutKeyboardFunc(key);
+  glutPassiveMotionFunc(mouse_move);
+  glutMainLoop();
+  return 0;
+}

+ 1 - 0
examples/shared/cheburashka.obj.REMOVED.git-id

@@ -0,0 +1 @@
+b8f4b722b5901bcb2a17dbc6f9b89eaa14bc8243

+ 1 - 0
include/igl/cat.cpp

@@ -144,4 +144,5 @@ template Eigen::Matrix<double, -1, -1, 0, -1, -1> igl::cat<Eigen::Matrix<double,
 template Eigen::SparseMatrix<double, 0, int> igl::cat<Eigen::SparseMatrix<double, 0, int> >(int, Eigen::SparseMatrix<double, 0, int> const&, Eigen::SparseMatrix<double, 0, int> const&);
 // generated by autoexplicit.sh
 template Eigen::Matrix<int, -1, -1, 0, -1, -1> igl::cat<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(int, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&, Eigen::Matrix<int, -1, -1, 0, -1, -1> const&);
+template void igl::cat<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1> >(int, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, 1, 0, -1, 1> > const&, Eigen::Matrix<double, -1, 1, 0, -1, 1>&);
 #endif

+ 0 - 180
include/igl/embree/EmbreeIntersector.cpp

@@ -1,180 +0,0 @@
-#include "EmbreeIntersector.h"
-#include <igl/EPS.h>
-
-template <typename RowVector3>
-inline embree::Vec3f toVec3f(const RowVector3 &p) { return embree::Vec3f((float)p[0], (float)p[1], (float)p[2]); }
-
-template <
-typename PointMatrixType,
-typename FaceMatrixType,
-typename RowVector3>
-igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
-::EmbreeIntersector(const PointMatrixType & V, const FaceMatrixType & F)
-{
-  static bool inited = false;
-  if(!inited)
-  {
-	//embree::TaskScheduler::start();//init();
-    inited = true;
-  }
-  
-  size_t numVertices = 0;
-  size_t numTriangles = 0;
-  
-  triangles = (embree::BuildTriangle*) embree::rtcMalloc(sizeof(embree::BuildTriangle) * F.rows());
-  vertices = (embree::BuildVertex*) embree::rtcMalloc(sizeof(embree::BuildVertex) * V.rows());
-
-  for(int i = 0; i < (int)V.rows(); ++i)
-  {
-    vertices[numVertices++] = embree::BuildVertex((float)V(i,0),(float)V(i,1),(float)V(i,2));
-  }
-  
-  for(int i = 0; i < (int)F.rows(); ++i)
-  {
-    triangles[numTriangles++] = embree::BuildTriangle((int)F(i,0),(int)F(i,1),(int)F(i,2),i);
-  }
-  
-  _accel = embree::rtcCreateAccel("default", "default", triangles, numTriangles, vertices, numVertices);
-  _intersector = _accel->queryInterface<embree::Intersector>();
-}
-
-template <
-typename PointMatrixType,
-typename FaceMatrixType,
-typename RowVector3>
-igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
-::~EmbreeIntersector()
-{
-	embree::rtcFreeMemory();
-}
-
-template <
-typename PointMatrixType,
-typename FaceMatrixType,
-typename RowVector3>
-bool 
-igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
-::intersectRay(const RowVector3& origin, const RowVector3& direction, embree::Hit &hit) const
-{
-  embree::Ray ray(toVec3f(origin), toVec3f(direction), 1e-4f);
-  _intersector->intersect(ray, hit);
-  return hit ; 
-}
-
-template <
-typename PointMatrixType,
-typename FaceMatrixType,
-typename RowVector3>
-bool 
-igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
-::intersectRay(
-  const RowVector3& origin, 
-  const RowVector3& direction, 
-  std::vector<embree::Hit > &hits,
-  int & num_rays) const
-{
-  using namespace std;
-  num_rays = 0;
-  hits.clear();
-  embree::Vec3f o = toVec3f(origin);
-  embree::Vec3f d = toVec3f(direction);
-  int last_id0 = -1;
-  double self_hits = 0;
-  // This epsilon is directly correleated to the number of missed hits, smaller
-  // means more accurate and slower
-  //const double eps = DOUBLE_EPS;
-  const double eps = FLOAT_EPS;
-  double min_t = embree::zero;
-  bool large_hits_warned = false;
-  while(true)
-  {
-#ifdef VERBOSE
-    cout<<
-      o[0]<<" "<<o[1]<<" "<<o[2]<<" + t*"<<
-      d[0]<<" "<<d[1]<<" "<<d[2]<<" ---> "<<
-      endl;
-#endif
-    embree::Hit hit;
-    embree::Ray ray(o,d,min_t);
-    num_rays++;
-    _intersector->intersect(ray, hit);
-    if(hit)
-    {
-      // Hit self again, progressively advance
-      if(hit.id0 == last_id0 || hit.t <= min_t)
-      {
-        // sanity check
-        assert(hit.t<1);
-        // push min_t a bit more
-        //double t_push = pow(2.0,self_hits-4)*(hit.t<eps?eps:hit.t);
-        double t_push = pow(2.0,self_hits)*eps;
-#ifdef VERBOSE
-        cout<<"  t_push: "<<t_push<<endl;
-#endif
-        //o = o+t_push*d;
-        min_t += t_push;
-        self_hits++;
-      }else
-      {
-        hits.push_back(hit);
-#ifdef VERBOSE
-        cout<<"  t: "<<hit.t<<endl;
-#endif
-        // Instead of moving origin, just change min_t. That way calculations
-        // all use exactly same origin values
-        min_t = hit.t;
-
-        // reset t_scale
-        self_hits = 0;
-      }
-      last_id0 = hit.id0;
-      //cout<<"  id0: "<<hit.id0<<endl;
-    }else
-    {
-      break;
-    }
-    if(hits.size()>1000 && !large_hits_warned)
-    {
-      cerr<<"Warning: Large number of hits..."<<endl;
-      cerr<<"[ ";
-      for(vector<embree::Hit>::iterator hit = hits.begin();
-          hit != hits.end();
-          hit++)
-      {
-        cerr<<(hit->id0+1)<<" ";
-      }
-      cerr.precision(std::numeric_limits< double >::digits10);
-      cerr<<"[ ";
-      for(vector<embree::Hit>::iterator hit = hits.begin();
-          hit != hits.end();
-          hit++)
-      {
-        cerr<<(hit->t)<<endl;;
-      }
-
-      cerr<<"]"<<endl;
-      large_hits_warned = true;
-      return hits.empty();
-    }
-  }
-  return hits.empty();
-}
-
-template <
-typename PointMatrixType,
-typename FaceMatrixType,
-typename RowVector3>
-bool 
-igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
-::intersectSegment(const RowVector3& a, const RowVector3& ab, embree::Hit &hit) const
-{
-  embree::Ray ray(toVec3f(a), toVec3f(ab), embree::zero, embree::one);
-  _intersector->intersect(ray, hit);
-  return hit ; 
-}
-
-#ifndef IGL_HEADER_ONLY
-// Explicit template instanciation
-#include <Eigen/Core>
-template class igl::EmbreeIntersector<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, 3, 1, 0, 3, 1> >;
-#endif

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

@@ -24,6 +24,7 @@ namespace igl
     //
     // Note: this will only find front-facing hits. To consider all hits then
     // pass [F;fliplr(F)]
+    EmbreeIntersector();
     EmbreeIntersector(const PointMatrixType & V, const FaceMatrixType & F);
     virtual ~EmbreeIntersector();
   
@@ -71,8 +72,195 @@ namespace igl
     embree::Ref<embree::Intersector> _intersector;
   };
 }
-#ifdef IGL_HEADER_ONLY
-#  include "EmbreeIntersector.cpp"
+
+// Implementation
+#include <igl/EPS.h>
+
+template <typename RowVector3>
+inline embree::Vec3f toVec3f(const RowVector3 &p) { return embree::Vec3f((float)p[0], (float)p[1], (float)p[2]); }
+
+template <
+typename PointMatrixType,
+typename FaceMatrixType,
+typename RowVector3>
+igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
+::EmbreeIntersector()
+{
+  static bool inited = false;
+  if(!inited)
+  {
+	//embree::TaskScheduler::start();//init();
+    inited = true;
+  }
+}
+
+template <
+typename PointMatrixType,
+typename FaceMatrixType,
+typename RowVector3>
+igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
+::EmbreeIntersector(const PointMatrixType & V, const FaceMatrixType & F)
+{
+  static bool inited = false;
+  if(!inited)
+  {
+	//embree::TaskScheduler::start();//init();
+    inited = true;
+  }
+  
+  size_t numVertices = 0;
+  size_t numTriangles = 0;
+  
+  triangles = (embree::BuildTriangle*) embree::rtcMalloc(sizeof(embree::BuildTriangle) * F.rows());
+  vertices = (embree::BuildVertex*) embree::rtcMalloc(sizeof(embree::BuildVertex) * V.rows());
+
+  for(int i = 0; i < (int)V.rows(); ++i)
+  {
+    vertices[numVertices++] = embree::BuildVertex((float)V(i,0),(float)V(i,1),(float)V(i,2));
+  }
+  
+  for(int i = 0; i < (int)F.rows(); ++i)
+  {
+    triangles[numTriangles++] = embree::BuildTriangle((int)F(i,0),(int)F(i,1),(int)F(i,2),i);
+  }
+  
+  _accel = embree::rtcCreateAccel("default", "default", triangles, numTriangles, vertices, numVertices);
+  _intersector = _accel->queryInterface<embree::Intersector>();
+}
+
+template <
+typename PointMatrixType,
+typename FaceMatrixType,
+typename RowVector3>
+igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
+::~EmbreeIntersector()
+{
+	embree::rtcFreeMemory();
+}
+
+template <
+typename PointMatrixType,
+typename FaceMatrixType,
+typename RowVector3>
+bool 
+igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
+::intersectRay(const RowVector3& origin, const RowVector3& direction, embree::Hit &hit) const
+{
+  embree::Ray ray(toVec3f(origin), toVec3f(direction), 1e-4f);
+  _intersector->intersect(ray, hit);
+  return hit ; 
+}
+
+template <
+typename PointMatrixType,
+typename FaceMatrixType,
+typename RowVector3>
+bool 
+igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
+::intersectRay(
+  const RowVector3& origin, 
+  const RowVector3& direction, 
+  std::vector<embree::Hit > &hits,
+  int & num_rays) const
+{
+  using namespace std;
+  num_rays = 0;
+  hits.clear();
+  embree::Vec3f o = toVec3f(origin);
+  embree::Vec3f d = toVec3f(direction);
+  int last_id0 = -1;
+  double self_hits = 0;
+  // This epsilon is directly correleated to the number of missed hits, smaller
+  // means more accurate and slower
+  //const double eps = DOUBLE_EPS;
+  const double eps = FLOAT_EPS;
+  double min_t = embree::zero;
+  bool large_hits_warned = false;
+  while(true)
+  {
+#ifdef VERBOSE
+    cout<<
+      o[0]<<" "<<o[1]<<" "<<o[2]<<" + t*"<<
+      d[0]<<" "<<d[1]<<" "<<d[2]<<" ---> "<<
+      endl;
 #endif
+    embree::Hit hit;
+    embree::Ray ray(o,d,min_t);
+    num_rays++;
+    _intersector->intersect(ray, hit);
+    if(hit)
+    {
+      // Hit self again, progressively advance
+      if(hit.id0 == last_id0 || hit.t <= min_t)
+      {
+        // sanity check
+        assert(hit.t<1);
+        // push min_t a bit more
+        //double t_push = pow(2.0,self_hits-4)*(hit.t<eps?eps:hit.t);
+        double t_push = pow(2.0,self_hits)*eps;
+#ifdef VERBOSE
+        cout<<"  t_push: "<<t_push<<endl;
+#endif
+        //o = o+t_push*d;
+        min_t += t_push;
+        self_hits++;
+      }else
+      {
+        hits.push_back(hit);
+#ifdef VERBOSE
+        cout<<"  t: "<<hit.t<<endl;
+#endif
+        // Instead of moving origin, just change min_t. That way calculations
+        // all use exactly same origin values
+        min_t = hit.t;
+
+        // reset t_scale
+        self_hits = 0;
+      }
+      last_id0 = hit.id0;
+      //cout<<"  id0: "<<hit.id0<<endl;
+    }else
+    {
+      break;
+    }
+    if(hits.size()>1000 && !large_hits_warned)
+    {
+      cerr<<"Warning: Large number of hits..."<<endl;
+      cerr<<"[ ";
+      for(vector<embree::Hit>::iterator hit = hits.begin();
+          hit != hits.end();
+          hit++)
+      {
+        cerr<<(hit->id0+1)<<" ";
+      }
+      cerr.precision(std::numeric_limits< double >::digits10);
+      cerr<<"[ ";
+      for(vector<embree::Hit>::iterator hit = hits.begin();
+          hit != hits.end();
+          hit++)
+      {
+        cerr<<(hit->t)<<endl;;
+      }
+
+      cerr<<"]"<<endl;
+      large_hits_warned = true;
+      return hits.empty();
+    }
+  }
+  return hits.empty();
+}
+
+template <
+typename PointMatrixType,
+typename FaceMatrixType,
+typename RowVector3>
+bool 
+igl::EmbreeIntersector < PointMatrixType, FaceMatrixType, RowVector3>
+::intersectSegment(const RowVector3& a, const RowVector3& ab, embree::Hit &hit) const
+{
+  embree::Ray ray(toVec3f(a), toVec3f(ab), embree::zero, embree::one);
+  _intersector->intersect(ray, hit);
+  return hit ; 
+}
 
 #endif //EMBREE_INTERSECTOR_H

+ 8 - 9
include/igl/mosek/mosek_quadprog.cpp

@@ -91,15 +91,15 @@ IGL_INLINE bool igl::mosek_quadprog(
 
   // Create the MOSEK environment
   mosek_guarded(MSK_makeenv(&env,NULL,NULL,NULL,NULL));
-  /* Directs the log stream to the 'printstr' function. */
-  mosek_guarded(MSK_linkfunctoenvstream(env,MSK_STREAM_LOG,NULL,printstr));
+  ///* Directs the log stream to the 'printstr' function. */
+  //mosek_guarded(MSK_linkfunctoenvstream(env,MSK_STREAM_LOG,NULL,printstr));
   // initialize mosek environment
   mosek_guarded(MSK_initenv(env));
   // Create the optimization task
   mosek_guarded(MSK_maketask(env,m,n,&task));
   verbose("Creating task with %ld linear constraints and %ld variables...\n",m,n);
-  // Tell mosek how to print to std out
-  mosek_guarded(MSK_linkfunctotaskstream(task,MSK_STREAM_LOG,NULL,printstr));
+  //// Tell mosek how to print to std out
+  //mosek_guarded(MSK_linkfunctotaskstream(task,MSK_STREAM_LOG,NULL,printstr));
   // Give estimate of number of variables
   mosek_guarded(MSK_putmaxnumvar(task,n));
   if(m>0)
@@ -171,8 +171,7 @@ IGL_INLINE bool igl::mosek_quadprog(
     pit != mosek_data.intparam.end(); 
     pit++)
   {
-    const MSKrescodee r = MSK_putintparam(task,pit->first,pit->second);
-    mosek_guarded(r);
+    mosek_guarded(MSK_putintparam(task,pit->first,pit->second));
   }
   for(
     std::map<MSKdparame,double>::iterator pit = mosek_data.douparam.begin();
@@ -187,9 +186,9 @@ IGL_INLINE bool igl::mosek_quadprog(
   // run the optimizer
   mosek_guarded(MSK_optimizetrm(task,&trmcode));
 
-  // Print a summary containing information about the solution for debugging
-  // purposes
-  MSK_solutionsummary(task,MSK_STREAM_LOG);
+  //// Print a summary containing information about the solution for debugging
+  //// purposes
+  //MSK_solutionsummary(task,MSK_STREAM_LOG);
 
   // Get status of solution
   MSKsolstae solsta;