1 /****************************************************************************
2 * VCGLib o o *
3 * Visual and Computer Graphics Library o o *
4 * _ O _ *
5 * Copyright(C) 2004-2016 \/)\/ *
6 * Visual Computing Lab /\/| *
7 * ISTI - Italian National Research Council | *
8 * \ *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
20 * for more details. *
21 * *
22 ****************************************************************************/
23 /****************************************************************************
24 History
25
26 $Log: not supported by cvs2svn $
27 Revision 1.10 2005/11/12 06:48:47 cignoni
28 Version 1.0
29 Added management of point set, correct bug in printing on the screen,
30
31 Revision 1.9 2005/01/03 13:59:54 cignoni
32 Resolved min/max macro conflict
33
34 Revision 1.8 2004/09/30 00:57:42 ponchio
35 Reference to temporary fixed and indented.
36
37 Revision 1.7 2004/09/28 09:46:51 cignoni
38 Added MapFalseColor
39
40 Revision 1.6 2004/09/16 14:08:35 ponchio
41 gamma is a math function.
42
43 Revision 1.5 2004/09/10 14:02:20 cignoni
44 Added Cone directions
45
46 Revision 1.4 2004/09/09 22:34:38 cignoni
47 Integrated lost modifications...
48
49 Revision 1.3 2004/09/09 14:35:54 ponchio
50 Various changes for gcc compatibility
51
52 Revision 1.2 2004/07/11 22:13:30 cignoni
53 Added GPL comments
54
55
56 ****************************************************************************/
57 #include <stdlib.h>
58 #include <stdio.h>
59 #include <stdarg.h>
60 #include <time.h>
61 // this define is mandatory to avoid the conflicts due to the silly definition of
62 // min and max macros in windows.h (included by glut...)
63 #define NOMINMAX
64
65 #include <GL/glew.h>
66 #include <GL/glut.h>
67 #include <wrap/gl/space.h>
68
69
70 #include <wrap/callback.h>
71 #include <vcg/math/base.h>
72 #include <wrap/gui/trackball.h>
73 #include <vcg/simplex/vertex/with/vcvn.h>
74 #include <vcg/simplex/vertex/with/vcvn.h>
75 #include <vcg/simplex/face/with/fn.h>
76 #include <vcg/space/index/grid_static_ptr.h>
77 #include <vcg/complex/complex.h>
78 #include<wrap/io_trimesh/export_ply.h>
79 #include<wrap/io_trimesh/import_ply.h>
80 #include<vcg/complex/algorithms/update/normal.h>
81 #include<vcg/complex/algorithms/update/bounding.h>
82 #include<vcg/complex/algorithms/update/color.h>
83
84 #include "visshader.h"
85 using namespace vcg;
86 using namespace std;
87
88
89
90
91 // Vertex, Face, Mesh and Grid definitions.
92 class MyEdge;
93 class AFace;
94 class AVertex : public VertexVCVN< float ,MyEdge,AFace > {};
95 class AFace : public FaceFN< AVertex,MyEdge,AFace > {};
96 class AMesh : public tri::TriMesh< vector<AVertex>, vector<AFace> > {};
97
98 ///////// Global ////////
99
100 int SampleNum=64;
101 int WindowRes=800;
102 unsigned int TexInd=0;
103 bool SwapFlag=false;
104 bool CullFlag=false;
105 bool ClosedFlag=false;
106 Point3f ConeDir(0,1,0);
107 float ConeAngleRad = math::ToRad(180.0f);
108
109 float lopass=0,hipass=1,gamma_correction=1;
110 float diff=.8;
111 float ambi=.2;
112
113 bool LightFlag=true;
114 bool ColorFlag=true;
115 bool FalseColorFlag=false;
116 bool ShowDirFlag=false;
117 int imgcnt=0;
118
119 Color4b BaseColor=Color4b::White;
120 Trackball QV;
121 Trackball QL;
122 Trackball *Q=&QV;
123
124 int ScreenH,ScreenW;
125 float ViewAngle=33;
126 vector<Point3f> ViewVector;
127
cb(const char * buf)128 bool cb(const char *buf)
129 {
130 printf(buf);
131 return true;
132 }
133
BuildOnePixelTexture(Color4b c,unsigned int & TexInd)134 void BuildOnePixelTexture(Color4b c, unsigned int &TexInd)
135 {
136 if(TexInd==0) glGenTextures(1,&TexInd);
137
138 glBindTexture(GL_TEXTURE_1D,TexInd);
139 glTexImage1D(GL_TEXTURE_1D,0,GL_RGBA,1,0,GL_RGBA,GL_UNSIGNED_BYTE,&c);
140 glEnable(GL_TEXTURE_1D);
141 glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
142 }
glutPrintf(int x,int y,const char * f,...)143 void glutPrintf(int x, int y, const char * f, ... )
144 {
145 glMatrixMode (GL_PROJECTION);
146 glPushMatrix();
147 glLoadIdentity ();
148 glOrtho(0,ScreenW,0,ScreenH,-1,1);
149 glMatrixMode (GL_MODELVIEW);
150 glPushMatrix();
151 glLoadIdentity ();
152
153 int len, i;
154 char buf[4096];
155 va_list marker;
156 va_start( marker, f );
157
158 int n = vsprintf(buf,f,marker);
159 va_end( marker );
160 glPushAttrib(GL_ENABLE_BIT);
161 glDisable(GL_LIGHTING);
162 glColor3f(0,0,0);
163 glRasterPos2f(x, y);
164 len = (int) strlen(buf);
165 for (i = 0; i < len; i++) {
166 glutBitmapCharacter(GLUT_BITMAP_HELVETICA_12, buf[i]);
167 }
168 glMatrixMode (GL_PROJECTION);
169 glPopMatrix();
170 glMatrixMode (GL_MODELVIEW);
171 glPopMatrix();
172 glPopAttrib();
173 }
174
175 // prototypes
176 void SaveTexturedGround();
177
DrawViewVector()178 void DrawViewVector()
179 {
180 glDisable(GL_LIGHTING);
181 glColor3f(0,0,1);
182 glBegin(GL_LINES);
183 for(unsigned int i=0;i<ViewVector.size();++i)
184 {
185 glVertex3f(0,0,0);glVertex(ViewVector[i]);
186 }
187 glEnd();
188 }
DrawLightVector()189 void DrawLightVector()
190 {
191 const int sz=5;
192 glPushMatrix();
193 QL.Apply();
194 glDisable(GL_LIGHTING);
195 glBegin(GL_LINES);
196 glColor3f(1,1,0);
197 for(unsigned int i=0;i<=sz;++i)
198 for(unsigned int j=0;j<=sz;++j)
199 {
200 glColor3f(1,1,0);
201 glVertex3f(-1.0f+i*2.0/sz,-1.0f+j*2.0/sz,-1);
202 glVertex3f(-1.0f+i*2.0/sz,-1.0f+j*2.0/sz, 1);
203 }
204 glEnd();
205 glPopMatrix();
206 }
207
Draw(AMesh & mm)208 void Draw(AMesh &mm)
209 {
210 if(mm.face.empty())
211 {
212 glPushAttrib(GL_ENABLE_BIT);
213 glDisable(GL_LIGHTING);
214 AMesh::VertexIterator vi;
215 glBegin(GL_POINTS);
216 for(vi=mm.vert.begin();vi!=mm.vert.end();++vi)
217 {
218 if(ColorFlag) glColor((*vi).C());
219 glVertex((*vi).P());
220 }
221 glEnd();
222 glPopAttrib();
223 }
224 else
225 {
226 AMesh::FaceIterator fi;
227 glBegin(GL_TRIANGLES);
228 for(fi=mm.face.begin();fi!=mm.face.end();++fi)
229 {
230 glNormal((*fi).V(0)->N()); if(ColorFlag) glColor((*fi).V(0)->C()); glVertex((*fi).V(0)->P());
231 glNormal((*fi).V(1)->N()); if(ColorFlag) glColor((*fi).V(1)->C()); glVertex((*fi).V(1)->P());
232 glNormal((*fi).V(2)->N()); if(ColorFlag) glColor((*fi).V(2)->C()); glVertex((*fi).V(2)->P());
233 }
234 glEnd();
235 }
236 }
237
238 AMesh m;
239 VertexVisShader<AMesh> Vis(m);
240
241 string OutNameMsh;
242
243
244 /* Called when the window is first opened and whenever
245 * the window is reconfigured (moved or resized).
246 */
ViewReshape(GLsizei w,GLsizei h)247 void ViewReshape(GLsizei w, GLsizei h)
248 {
249 ScreenW=w; ScreenH=h;
250 glViewport(0,0,w,h);
251 }
252
ViewDisplay(void)253 void ViewDisplay (void)
254 {
255 glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
256 glMatrixMode (GL_PROJECTION);
257 glLoadIdentity ();
258 gluPerspective(ViewAngle,(float)ScreenW/ScreenH,1,7);
259 glMatrixMode (GL_MODELVIEW);
260 glLoadIdentity ();
261 glPushMatrix();
262 QL.Apply();
263 glutPrintf(5,5,"Diffuse %04.2f Ambient %04.2f "
264 " LowPass %04.2f HiPass %04.2f Gamma %04.2f rgb = %03i:%03i:%03i",
265 diff,ambi,lopass,hipass,gamma_correction,BaseColor[0],BaseColor[1],BaseColor[2]);
266
267 GLfloat light_position0[] = {0.0, 10.0, 300.0, 0.0};
268 glLightfv(GL_LIGHT0, GL_POSITION, light_position0);
269 glPopMatrix();
270 glTranslatef(0,0,-4);
271 if(Q==&QL) DrawLightVector();
272 QL.GetView();
273 QV.GetView();
274 QV.Apply();
275 if(ShowDirFlag) DrawViewVector();
276
277 float d = 2.0/m.bbox.Diag();
278 glScalef(d, d, d);
279 glColor3f(diff,diff,diff);
280 glTranslate(-m.bbox.Center());
281 if(LightFlag) glEnable(GL_LIGHTING);
282 else glDisable(GL_LIGHTING);
283 if(ColorFlag) glEnable(GL_COLOR_MATERIAL);
284 else glDisable(GL_COLOR_MATERIAL);
285 if(FalseColorFlag) glColorMaterial(GL_FRONT,GL_DIFFUSE);
286 else glColorMaterial(GL_FRONT,GL_AMBIENT);
287
288 glMateriali(GL_FRONT,GL_SHININESS,0);
289 float spec[4]={0,0,0,1};
290 float ambientV[4]={ambi,ambi,ambi,1};
291 float diffuseV[4]={diff,diff,diff,1};
292 glMaterialfv(GL_FRONT,GL_SPECULAR,spec);
293 glMaterialfv(GL_FRONT,GL_AMBIENT, ambientV);
294 glMaterialfv(GL_FRONT,GL_DIFFUSE, diffuseV);
295 glCullFace(GL_BACK);
296
297 if(CullFlag) glEnable(GL_CULL_FACE);
298 else glDisable(GL_CULL_FACE);
299
300 BuildOnePixelTexture(BaseColor,TexInd);
301 Draw(m);
302 glutSwapBuffers();
303 }
304
ViewSpecialKey(int,int,int)305 void ViewSpecialKey(int , int , int )
306 {
307 glutPostRedisplay();
308 }
Toggle(bool & flag)309 void Toggle(bool &flag) {flag = !flag;}
UpdateVis()310 void UpdateVis()
311 {
312 if( LightFlag && !FalseColorFlag)
313 Vis.MapVisibility(gamma_correction,lopass,hipass,ambi);
314 if(!LightFlag && !FalseColorFlag)
315 Vis.MapVisibility(gamma_correction,lopass,hipass,1.0);
316 if(FalseColorFlag)
317 Vis.MapFalseColor();
318 }
319 /*********************************************************************/
320 /*********************************************************************/
321 /*********************************************************************/
322
ViewKey(unsigned char key,int,int)323 void ViewKey(unsigned char key, int , int )
324 {
325 Point3f dir;
326 switch (key) {
327 case 27: exit(0); break;
328 case 9: if(Q==&QV) Q=&QL;else Q=&QV; break;
329 case 'l' :
330 lopass=lopass+.05;
331 printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
332 UpdateVis(); break;
333 case 'L' :
334 lopass=lopass-.05;
335 printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
336 UpdateVis(); break;
337 case 'h' :
338 hipass=hipass-.05;
339 printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
340 UpdateVis(); break;
341 case 'H' :
342 hipass=hipass+.05;
343 printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
344 UpdateVis(); break;
345 case 'd' : diff+=.05; printf("Ambient %f Diffuse %f, \n",ambi,diff); UpdateVis(); break;
346 case 'D' : diff-=.05; printf("Ambient %f Diffuse %f, \n",ambi,diff); UpdateVis(); break;
347 case 'a' : ambi+=.05; printf("Ambient %f Diffuse %f, \n",ambi,diff); UpdateVis(); break;
348 case 'A' : ambi-=.05; printf("Ambient %f Diffuse %f, \n",ambi,diff); UpdateVis(); break;
349
350 case 'e' : ambi+=.05; diff-=.05;
351 printf("Ambient %f Diffuse %f, \n",ambi,diff);
352 UpdateVis(); break;
353 case 'E' : ambi-=.05; diff+=.05;
354 printf("Ambient %f Diffuse %f, \n",ambi,diff);
355 UpdateVis(); break;
356 case 'p' :
357 gamma_correction=gamma_correction-.05;
358 printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
359 UpdateVis(); break;
360 case 'P' :
361 gamma_correction=gamma_correction+.05;
362 printf("Lo %f, Hi %f Gamma %f\n",lopass,hipass,gamma_correction);
363 UpdateVis(); break;
364 case 13 :
365 //Vis.ComputeUniform(SampleNum,ViewVector,cb);
366 Vis.ComputeUniformCone(SampleNum,ViewVector, ConeAngleRad,ConeDir,cb);
367 UpdateVis(); break;
368 case ' ' : {
369 Point3f dir = Q->camera.ViewPoint();
370 printf("ViewPoint %f %f %f\n",dir[0],dir[1],dir[2]);
371 dir.Normalize();
372 dir=Inverse(Q->track.Matrix())*dir;
373 printf("ViewPoint %f %f %f\n",dir[0],dir[1],dir[2]);
374 dir.Normalize();
375 Vis.ComputeSingle(dir,ViewVector,cb);
376 UpdateVis();
377 } break;
378 case 'r' : BaseColor[0]=min(255,BaseColor[0]+2); break;
379 case 'R' : BaseColor[0]=max( 0,BaseColor[0]-2); break;
380 case 'g' : BaseColor[1]=min(255,BaseColor[1]+2); break;
381 case 'G' : BaseColor[1]=max( 0,BaseColor[1]-2); break;
382 case 'b' : BaseColor[2]=min(255,BaseColor[2]+2); break;
383 case 'B' : BaseColor[2]=max( 0,BaseColor[2]-2); break;
384
385 case 'v' : Toggle(ShowDirFlag); break;
386 case 'V' :
387 {
388 SimplePic<Color4b> snapC;
389 snapC.OpenGLSnap();
390 char buf[128];
391 sprintf(buf,"Snap%03i.ppm",imgcnt++);
392 snapC.SavePPM(buf);
393 }
394 case 's' :
395 Vis.SmoothVisibility();
396 UpdateVis(); break;
397 case 't' :
398 Vis.SmoothVisibility(true);
399 UpdateVis(); break;
400 case 'S' :
401 {
402 vcg::tri::io::PlyInfo p;
403 p.mask|=vcg::tri::io::Mask::IOM_VERTCOLOR /* | vcg::ply::PLYMask::PM_VERTQUALITY*/ ;
404 tri::io::ExporterPLY<AMesh>::Save(m,OutNameMsh.c_str(),false,p);
405 }
406 break;
407 case 'C' : LightFlag = !LightFlag;
408 printf("Toggled Light %s\n",LightFlag?"on":"off");
409 UpdateVis(); break;
410 case 'c' : ColorFlag = !ColorFlag;
411 printf("Toggled Color %s\n",ColorFlag?"on":"off"); break;
412 case 'f' : FalseColorFlag = !FalseColorFlag;
413 printf("Toggled FalseColor %s\n",ColorFlag?"on":"off");
414 UpdateVis(); break;
415
416 case '1' : diff=0.80f; ambi=0.10f; gamma_correction=1.0; lopass=0.00f; hipass=1.00f; ColorFlag=false; UpdateVis(); break;
417 case '2' : diff=0.65f; ambi=0.30f; gamma_correction=1.0; lopass=0.15f; hipass=0.80f; ColorFlag=true; UpdateVis(); break;
418 case '3' : diff=0.45f; ambi=0.50f; gamma_correction=1.0; lopass=0.20f; hipass=0.75f; ColorFlag=true; UpdateVis(); break;
419 case '4' : diff=0.35f; ambi=0.60f; gamma_correction=1.0; lopass=0.25f; hipass=0.70f; ColorFlag=true; UpdateVis(); break;
420 }
421 glutPostRedisplay(); ;
422 }
ViewMenu(int val)423 void ViewMenu(int val)
424 {
425 ViewKey(val, 0, 0);
426 }
427 /*********************************************************************/
428 // TrackBall Functions
429 /*********************************************************************/
430
431 int GW,GH; // Grandezza della finestra
432
ViewMouse(int button,int state,int x,int y)433 void ViewMouse(int button, int state, int x, int y)
434 {
435 static int KeyMod=0;
436 static int glut_buttons=0;
437 //printf("ViewMouse %i %i %i %i\n",x,y,button,state);
438 int m_mask = 0;
439 if(state == GLUT_DOWN) {
440 KeyMod=glutGetModifiers();
441 if(GLUT_ACTIVE_SHIFT & KeyMod) m_mask |= Trackball::KEY_SHIFT;
442 if(GLUT_ACTIVE_ALT & KeyMod) m_mask |= Trackball::KEY_ALT;
443 if(GLUT_ACTIVE_CTRL & KeyMod) m_mask |= Trackball::KEY_CTRL;
444
445 glut_buttons |= (1<<button);
446 Q->MouseDown(x, ScreenH-y, glut_buttons | m_mask);
447 } else {
448 if(GLUT_ACTIVE_SHIFT & KeyMod) m_mask |= Trackball::KEY_SHIFT;
449 if(GLUT_ACTIVE_ALT & KeyMod) m_mask |= Trackball::KEY_ALT;
450 if(GLUT_ACTIVE_CTRL & KeyMod) m_mask |= Trackball::KEY_CTRL;
451 glut_buttons |= (1<<button);
452 Q->MouseUp(x, ScreenH-y, glut_buttons | m_mask);
453 }
454 }
455
ViewMouseMotion(int x,int y)456 void ViewMouseMotion(int x, int y)
457 {
458 Q->MouseMove(x,ScreenH-y);
459 glutPostRedisplay();
460 }
461
SetLight()462 void SetLight()
463 {
464 GLfloat light_ambient0[] = {0.0, 0.0, 0.0, 1.0};
465 GLfloat light_diffuse0[] = {1.0, 1.0, 1.0, 1.0};
466 GLfloat light_position0[] = {0.0, 10.0, 300.0, 0.0};
467 glLightfv(GL_LIGHT0, GL_POSITION, light_position0);
468 glLightfv(GL_LIGHT0, GL_AMBIENT, light_diffuse0);
469 glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse0);
470 glEnable(GL_LIGHT0);
471 glLightModelfv(GL_LIGHT_MODEL_AMBIENT,light_ambient0);
472
473 }
474
ViewInit(void)475 void ViewInit (void) {
476 SetLight();
477 Q->Reset();
478 Q->radius= 1;
479 glEnable(GL_DEPTH_TEST);
480 glDepthFunc(GL_LEQUAL);
481 glClearColor (0.8, 0.8, 0.8, 0.0);
482 glEnable(GL_NORMALIZE);
483 glEnable(GL_LIGHTING);
484
485 // glEnable(GL_BLEND);
486 glShadeModel(GL_SMOOTH);
487 // glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
488 glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
489 glEnable(GL_CULL_FACE);
490 glCullFace(GL_BACK);
491 }
492
493
494
main(int argc,char ** argv)495 int main(int argc, char** argv)
496 {
497 if(argc<2) {
498 printf(
499 "shadevis 1.0 \n"__DATE__"\n"
500 "Copyright 2003-2004 Visual Computing Lab I.S.T.I. C.N.R.\n"
501 "Paolo Cignoni (cignoni@isti.cnr.it)\n\n"
502 "Usage: shadevis file.ply [options]\n"
503 "Options:\n"
504 " -w# WindowResolution (default 600)\n"
505 " -n# Sample Directions (default 64)\n"
506 " -z# z offset (default 1e-3)\n"
507 " -c assume that the mesh is closed (slightly faster, default false)\n"
508 " -f Flip normal of the model\n"
509 " -da # Cone Direction Angle in degree (default 180)\n"
510 " -dv # # # Cone Direction vector (default 0 0 1)\n"
511 );
512
513 return 1;
514 }
515
516 srand(time(0));
517 int i=1;
518 while(i<argc && (argv[i][0]=='-'))
519 {
520 switch(argv[i][1])
521 {
522 case 'd' :
523 if(argv[i][2] == 'a') {
524 ConeAngleRad = math::ToRad(atof(argv[i+1])); ++i; break;
525 }
526 if(argv[i][2] == 'v') {
527 Point3f p(atof(argv[i+1]),atof(argv[i+2]),atof(argv[i+3]));
528 ConeDir = Normalize(p);
529 i+=3; break;
530 }
531 printf("Error unable to parse option '%s'\n",argv[i]);
532 exit(0);
533 break;
534 case 'n' : SampleNum = atoi(argv[i]+2); break;
535 case 'f' : SwapFlag=false; break;
536 case 'c' : ClosedFlag=true; break;
537 case 'w' : WindowRes= atoi(argv[i]+2);
538 printf("Set WindowRes to %i\n",WindowRes ); break;
539 case 's' : Vis.SplitNum= atoi(argv[i]+2);
540 printf("Set SplitNum to %i\n",Vis.SplitNum ); break;
541 case 'z' : Vis.ZTWIST = atof(argv[i]+2);
542 printf("Set ZTWIST to %f\n",Vis.ZTWIST ); break;
543 default: {
544 printf("Error unable to parse option '%s'\n",argv[i]);
545 exit(0);
546 }
547 }
548
549 ++i;
550 }
551
552
553 string basename = argv[i];
554 if(!(basename.substr(basename.length()-4)==".ply")) {
555 printf("Error: Unknown file extension %s\n",basename.c_str());
556 return 1;
557 }
558
559 // loading original mesh
560 int ret=tri::io::ImporterPLY<AMesh>::Open(m,argv[i]);
561 if(ret) {printf("Error unable to open mesh %s : '%s' \n",argv[i],tri::io::ImporterPLY<AMesh>::ErrorMsg(ret));exit(-1);}
562 tri::UpdateNormals<AMesh>::PerVertexNormalized(m);
563 tri::UpdateBounding<AMesh>::Box(m);
564 tri::UpdateColor<AMesh>::VertexConstant(m,Color4b::White);
565 Vis.IsClosedFlag=ClosedFlag;
566 Vis.Init();
567 UpdateVis();
568
569 printf("Mesh bbox (%f %f %f)-(%f %f %f)\n\n",
570 m.bbox.min[0],m.bbox.min[1],m.bbox.min[2],
571 m.bbox.max[0],m.bbox.max[1],m.bbox.max[2]);
572
573 OutNameMsh=(string(argv[i]).substr(0,strlen(argv[i])-4));
574 OutNameMsh+="_vis.ply";
575
576 printf("Mesh Output filename %s\n",OutNameMsh.c_str());
577
578 printf("Mesh %iv %if bbox Diag %g\n",m.vn,m.fn,m.bbox.Diag());
579
580 glutInit(&argc, argv);
581
582 glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
583 glutInitWindowSize(WindowRes, WindowRes);
584 glutInitWindowPosition (10,10);
585 glutCreateWindow ("shadevis - Visual Computing Lab - vcg.isti.cnr.it ");
586 glutDisplayFunc(ViewDisplay);
587 glutReshapeFunc(ViewReshape);
588 glutKeyboardFunc(ViewKey);
589 glutSpecialFunc(ViewSpecialKey);
590 glutMouseFunc(ViewMouse);
591 glutMotionFunc(ViewMouseMotion);
592
593 ViewInit();
594 glewInit();
595 glutMainLoop();
596
597 return(0);
598 }
599