Learnt today: Don’t use printf()
debugging within 3D applications.
At least, not with \n
. Some figures follow.
First case
while (!viewer.done ())
{
viewer.frame ();
printf(".");
/* … */
}
Gives roughly 75 FPS.
Second case
while (!viewer.done ())
{
viewer.frame ();
printf(".\n");
/* … */
}
Now gives roughly 35 FPS.
What‽
Yes, >50% performance hit due to newlines.
By the way, the OpenSceneGraph 3D framework is very pleasant to work with, and pretty well documented. Could almost make coding in C++ enjoyable. Almost.