GeoGen API Reference
Displaying render progress

This tutorial demonstrates how to display render progress to the user in real-time.

string code = "\n\
var a = HeightMap.Flat(0.2); \n\
var b = HeightMap.Flat(0.3); \n\
a.Add(b); \n\
yield a;";
compiler::Compiler compiler;
runtime::CompiledScript* compiledScript = compiler.CompileScript(code);
runtime::VirtualMachine vm(*compiledScript);
vm.Run();
renderer::Renderer renderer(vm.GetRenderingSequence());
// Instead of Run, the sequence is executed step by step.
{
renderer.Step();
cout << "Progress: " << renderer.GetProgress() << "%" << std::endl;
}
genlib::HeightMap* heightMap = renderer.GetRenderedMapTable().GetItem(renderer::Renderer::MAP_NAME_MAIN);
cout << "Finished!" << std::endl;

Full code