33namespace Experimental {
41class TestTriangleHandler {
43 static void tess_begin(
GLenum type, TriangleCollector *tc);
44 static void tess_vertex(
Int_t *vi, TriangleCollector *tc);
46 tess_combine(
GLdouble coords[3],
void *vertex_data[4],
GLfloat weight[4],
void **outData, TriangleCollector *tc);
47 static void tess_end(TriangleCollector *tc);
54void TestTriangleHandler::tess_begin(
GLenum type, TriangleCollector *tc)
57 tc->fV0 = tc->fV1 = -1;
64void TestTriangleHandler::tess_vertex(
Int_t *vi, TriangleCollector *tc)
66 tc->process_vertex(*vi);
72void TestTriangleHandler::tess_combine(
GLdouble [3],
void * [4],
76 throw std::runtime_error(
"GLU::TriangleCollector tesselator requested vertex combining -- not supported yet.");
82void TestTriangleHandler::tess_end(TriangleCollector *tc)
99 if (!
fTess)
throw std::bad_alloc();
147 add_triangle(fV0, fV1, vi);
153 if (fNVertices % 2 == 0)
154 add_triangle(fV1, fV0, vi);
156 add_triangle(fV0, fV1, vi);
163 add_triangle(fV0, fV1, vi);
169 throw std::runtime_error(
"GLU::TriangleCollector unexpected type in tess_vertex callback.");
178 const std::vector<Int_t> &
polys,
184 for (
Int_t i = 0, j = 0; i < n_polys; ++i)
186 Int_t n_points = pols[j++];
191 for (
Int_t k = 0; k < n_points; ++k, ++j)
198 static int except_cnt = 0;
203 if (except_cnt++ < 100) printf(
"Catch exception gluTessEndPolygon!\n");
#define GLU_TESS_BEGIN_DATA
#define GLU_TESS_COMBINE_DATA
GLAPI GLUtesselator *GLAPIENTRY gluNewTess(void)
GLAPI void GLAPIENTRY gluTessEndPolygon(GLUtesselator *tess)
#define GLU_TESS_END_DATA
GLAPI void GLAPIENTRY gluTessBeginContour(GLUtesselator *tess)
GLAPI void GLAPIENTRY gluTessBeginPolygon(GLUtesselator *tess, GLvoid *data)
#define GLU_TESS_VERTEX_DATA
GLAPI void GLAPIENTRY gluTessCallback(GLUtesselator *tess, GLenum which, _GLUfuncptr CallBackFunc)
#define GL_TRIANGLE_STRIP
GLAPI void GLAPIENTRY gluDeleteTess(GLUtesselator *tess)
GLAPI void GLAPIENTRY gluTessVertex(GLUtesselator *tess, GLdouble *location, GLvoid *data)
GLAPI void GLAPIENTRY gluTessEndContour(GLUtesselator *tess)
void ProcessData(const std::vector< Double_t > &verts, const std::vector< Int_t > &polys, const Int_t n_polys)
ProcessData.
void process_vertex(Int_t vi)
process_vertex
void add_triangle(Int_t v0, Int_t v1, Int_t v2)
add triangle
~TriangleCollector()
destructor
TriangleCollector()
constructor
std::vector< Int_t > fPolyDesc