I'm trying to use OpenCascade just for generating geometry, and I want to export all the primitives (just triangles, for now) to my own OpenGL-based 3D engine. Now, I'm creating the bodies properly (basically copying the code from some of the samples) and I'm using the standard triangulation loop, like so:
TopExp_Explorer exp(topoShape, TopAbs_FACE);
for ( ; exp.More(); exp.Next())
TopoDS_Face face = TopoDS::Face(exp.Current());
Handle(Poly_Triangulation) triangles = Handle(BRep_TFace)::DownCast(face.TShape())->Triangulation();
// OR using the BRep_Tool::Triangulation method
nbTriangles += triangles->NbTriangles();
// Then do whatever...
So the point is, triangles.IsNull() is always false here, even though the are faces in the shape, I can't get to any triangles. Does anyone have any ideas? Btw. I'm using VS2005, just headers and libraries, no QT, TCL or whatever's it's name and other stuff.