1

I am working on simulating the motion of an object and representing it with OpenGL. The moving object is displayed in subwindow 1 of an fltk window. I would like to show real time graphs of some physical quantities next to it, in subwindow 2. For now, I know how to call gnuplot from the program so that it is executed in a separate window:

    std::ofstream ou ("instructions.txt");
    ou <<"set palette rgb '#27ad81'" <<std::endl<<"splot \"file.txt\" every ::-1::0 with points palette pointsize 2 pointtype 2   notitle " << std::endl;
    for( int i = 0; i<(tf/h); i+=(0.1/h)){ //h is the time increment, tf is the time at which the simulation stops
        ou << "pause 0.1" << std::endl;
        ou << "replot \"file.txt\" every ::" << i << "::" << (i+(0.1/h)) << "with points palette pointsize 1 pointtype 1  notitle "<< std::endl;
    }
    system("gnuplot instructions.txt");
}

Is it possible to redirect the output of gnuplot to subwindow 2?

genpfault
  • 51,148
  • 11
  • 85
  • 139
Jatos
  • 333
  • 2
  • 13

0 Answers0