This part of the manual describes how to migrate from QGL viewer to Polyscope viewer
- Author
- Bastien Doignies
Introduction and features changes
With version 2.0 of DGtal, the internal and external structures of 3D visualization have been completely changed. The aim is to take advantage of the advanced features of Polyscope, a geometric object viewer.
The major changes are:
- No more QApplication class
- A simpler API with fewer classes
- More interaction with the simulation
Converting code from QGLViewer to PolyscopeViewer
The stream mechanism was kept, therefore, most draw commands remain the same. Here are the few steps to migrate from DGtal 1.4 to DGtal 2.0 are:
Example
Old 1.4 code:
QApplication application(argc,argv);
viewer.show();
viewer << SetMode3D( p1.className(), "PavingWired" );
viewer << p1 << p2 << p3;
viewer << SetMode3D( p1.className(), "Grid" );
viewer << CustomColors3D(Color(250, 0,0),Color(250, 0,0));
viewer << p4 << p5 ;
viewer << SetMode3D( p1.className(), "Both" );
viewer << CustomColors3D(Color(250, 200,0, 100),Color(250, 0,0, 100));
viewer << p6;
viewer << CustomColors3D(Color(250, 200,0, 100),Color(250, 200,0, 20));
viewer << p0;
viewer << SetMode3D(
domain.className(),
"Paving");
viewer << MyViewer::updateDisplay;
return application.exec();
HyperRectDomain< Space > Domain
PolyscopeViewer< Space, KSpace > MyViewer
New 2.0 code:
PolyscopeViewer viewer;
viewer.drawAsPaving();
viewer << p1 << p2 << p3;
viewer.drawAsGrid();
viewer << Color(250, 0,0) << p4 << p5;
viewer << Color(250, 0, 0, 100) << p6;
viewer << Color(250, 200, 0, 20) << p0;
viewer.drawAsPaving();
viewer.show();
return 0;
Feature losses
As part of the simplification process, here are the old features that now have no direct equivalent:
- Most Draw Modes have been removed but can be emulated by manipulating the viewer interactively.
- Image and Domain transform no longer have dedicated classes. To rotate and translate them, use elements transform instead (DisplayData::transform).
- Mesh exports and exports.