#ifndef MIQ_GL_UTILS #define MIQ_GL_UTILS //#include #include "vertex_indexing.h" class Miq_Gl_Utils { public: template static void GLDrawVertexIndexing(VertexIndexingType &VI) { typedef typename VertexIndexingType::ScalarType ScalarType; glPushAttrib(GL_ALL_ATTRIB_BITS); glEnable(GL_COLOR_MATERIAL); glDisable(GL_LIGHTING); glDepthRange(0,0.999); typename VertexIndexingType::ScalarType size=5; glPointSize(size); vcg::glColor(vcg::Color4b(0,255,0,255)); glBegin(GL_POINTS); for (unsigned int i=0;iIsD()); vcg::glVertex(VI.duplicated[i]->P()); } glEnd(); glPopAttrib(); } template static void DrawFlippedFacesIfSelected(MeshType &ParamMesh, bool DrawUV=false, vcg::Color4b color=vcg::Color4b(255,0,0,255), typename MeshType::ScalarType width=2.0) { typedef typename MeshType::FaceType FaceType; typedef typename MeshType::CoordType CoordType; typedef typename MeshType::ScalarType ScalarType; glPushAttrib(GL_ALL_ATTRIB_BITS); glDisable(GL_LIGHTING); glLineWidth(width); vcg::glColor(color); glBegin(GL_LINES); for (unsigned int i=0;iIsS())continue; for (int k=0;k<3;k++) { CoordType p0,p1; if (!DrawUV) { p0=f->P0(k); p1=f->P1(k); } else { p0=CoordType(f->WT(k).P().X(),f->WT(k).P().Y(),0); p1=CoordType(f->WT((k+1)%3).P().X(),f->WT((k+1)%3).P().Y(),0); } vcg::glVertex(p0); vcg::glVertex(p1); } } glEnd(); glPopAttrib(); } template static void QuadGLDrawIntegerVertices(QuadrangulatorType &Quadr) { glPushAttrib(GL_ALL_ATTRIB_BITS); glDisable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); glDisable(GL_TEXTURE_2D); glPointSize(8); glDepthRange(0,0.997); /*glColor3d(1,0,0);*/ glBegin(GL_POINTS); for (int i=0;iP(); if (v->IsV()) glColor3d(1,0,0); else glColor3d(1,1,0); glVertex(pos); } glEnd(); glPopAttrib(); } template static void GLDrawIntegerLines(QuadrangulatorType &Quadr) { glPushAttrib(GL_ALL_ATTRIB_BITS); glDisable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); glDisable(GL_TEXTURE_2D); glLineWidth(2); glColor3d(0,1,0); glDepthRange(0,0.998); for (int i=0;iV0(edge); typename QuadrangulatorType::TriVertexType* v1=f->V1(edge); glBegin(GL_LINES); glVertex(v0->P()); glVertex(v1->P()); glEnd(); } glPopAttrib(); } template static void GLDrawPolygons(QuadrangulatorType &Quadr) { glPushAttrib(GL_ALL_ATTRIB_BITS); glEnable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); glDisable(GL_TEXTURE_2D); glColor3d(0.7,0.8,0.9); //glFrontFace(GL_CW); glDepthRange(0,0.998); for (unsigned int i=0;iN()); glVertex(v->P()); } glEnd(); } glDepthRange(0,0.997); glDisable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); glColor3d(0,0,0); for (unsigned int i=0;iP()); } glEnd(); } glPopAttrib(); } template static void GLDrawPolygonalMesh(PolyMesh &polymesh) { glPushAttrib(GL_ALL_ATTRIB_BITS); glEnable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); glDisable(GL_TEXTURE_2D); glColor3d(0.7,0.8,0.9); //glFrontFace(GL_CW); glDepthRange(0,0.998); for (unsigned int i=0;iN()); glVertex(v->P()); } glEnd(); } glDepthRange(0,0.997); glDisable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); glColor3d(0,0,0); for (unsigned int i=0;iN()); glVertex(v->P()); } glEnd(); } glPopAttrib(); } }; #endif