Browse Source

mesh fix external

Former-commit-id: 992970b4ba75b10b90b810770a59a3aae1d4d833
Alec Jacobson (jalec 11 years ago
parent
commit
76e334fd0e
2 changed files with 12 additions and 1 deletions
  1. 10 0
      examples/textured-mesh/example.cpp
  2. 2 1
      include/igl/png/texture_from_file.cpp

+ 10 - 0
examples/textured-mesh/example.cpp

@@ -137,6 +137,7 @@ int tot_num_samples = 0;
 #define REBAR_NAME "temp.rbr"
 igl::ReTwBar rebar; // Pointer to the tweak bar
 bool flip_y = false;
+bool rotate_xy = false;
 
 void reshape(int width,int height)
 {
@@ -279,6 +280,11 @@ void display()
     glTranslated(0,1,0);
     glScaled(1,-1,1);
   }
+  if(rotate_xy)
+  {
+    glRotated(90,0,0,1);
+    glTranslated(-1,0,0);
+  }
   glMatrixMode(GL_MODELVIEW);
 
   draw_mesh(V,F,N,MatrixXi(),MatrixXd(),TC,TF,MatrixXd(),0,MatrixXi(),0);
@@ -523,6 +529,7 @@ int main(int argc, char * argv[])
   {
     if(!list_to_matrix(vV,V))
     {
+      cerr<<"Bad V"<<endl;
       return 1;
     }
     triangulate(vF,F);
@@ -531,6 +538,7 @@ int main(int argc, char * argv[])
   {
     if(!list_to_matrix(vTC,TC))
     {
+      cerr<<"Bad TC"<<endl;
       return 1;
     }
   }
@@ -538,6 +546,7 @@ int main(int argc, char * argv[])
   {
     if(!list_to_matrix(vTF,TF))
     {
+      cerr<<"Bad TF"<<endl;
       return 1;
     }
   }
@@ -577,6 +586,7 @@ int main(int argc, char * argv[])
   rebar.TwAddVarCB( "rotation_type", RotationTypeTW,
     set_rotation_type,get_rotation_type,NULL,"keyIncr=] keyDecr=[");
   rebar.TwAddVarRW("flip_y", TW_TYPE_BOOLCPP, &flip_y,"key=f");
+  rebar.TwAddVarRW("rotate_xy", TW_TYPE_BOOLCPP, &rotate_xy,"key=r");
   rebar.load(REBAR_NAME);
 
   glutInitDisplayString( "rgba depth double samples>=8 ");

+ 2 - 1
include/igl/png/texture_from_file.cpp

@@ -31,7 +31,8 @@ IGL_INLINE bool igl::texture_from_file(const std::string filename, GLuint & id)
 #ifdef __APPLE__
     // Convert to a temporary png file
     string tmp = "/var/tmp/.texture_from_file.png";
-    string command = STR("/opt/local/bin/convert "<<filename<<" "<<tmp);
+#define PATH_TO_CONVERT "/opt/local/bin/convert"
+    string command = STR(PATH_TO_CONVERT<<" \""<<filename<<"\" \""<<tmp<<"\"");
     try
     {
       if(system(command.c_str())==0)