thanks for all the submissions in an attempt to fix pipe stats in Producer on Windows, but ... a lot more was broken than the submissions began to scratch the surface of. I've now updated things so they compile in windows and run safely on Linux.
Find attached a test program that is working for me on Linux with NVidia drivers. Could someone test this with Windows and see if you can get the results you expect? Your driver needs to support the GL_EXT_timer_query extension. Documentation is a couple of years old so there should be good support for this.
ALso, ATI users see if this provides any output at all.
The test program queries pipe stats when stats are turned on. That is, it will provide you with actuall draw times (not Dispatch times as currently displayed in the viewer). I'm getting, typically, a couple hundred microseconds for the cow and 4-6 milliseconds for a complex CAD model with 500,000 polygons.
The output uses ANSI escape sequences that may not work under windows (Because of the 'S' in ANSI).
THanks,
-don
// C++ source file - Open Scene Graph Training - Copyright (C) 2004 Don Burns // Distributed under the terms of the GNU LIBRARY GENERAL PUBLIC LICENSE (LGPL) // as published by the Free Software Foundation.
#include <stdio.h>
#include <iostream>
#include <osgDB/ReadFile>
#include <osgUtil/Optimizer>
#include <osgProducer/Viewer>
int main(int argc, char **argv)
{
// Parse command line arguments
osg::ArgumentParser args( &argc, argv );
// Set up the viewer
osgProducer::Viewer viewer(args);
viewer.setUpViewer(osgProducer::Viewer::STANDARD_SETTINGS);
// Load up the models specified on the command line
osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFiles(args);
if( !loadedModel.valid() )
{
std::cerr << argv[0] << ": No data loaded. Exiting." << std::endl;
return 1;
}
// Optionally tell the viewer what to display for a help message
viewer.getUsage(*args.getApplicationUsage());
// Optimize the scene
osgUtil::Optimizer optimizer;
optimizer.optimize(loadedModel.get());
// set the scene to render
viewer.setSceneData(loadedModel.get());
Producer::PipeTimer::instance()->setReturnType( Producer::PipeTimer::milliseconds );
// Realize the viewer
viewer.realize();
std::cout << "\033[2J" << std::endl;
while( !viewer.done() )
{
viewer.sync();
std::cout << "\033[0;0H PipeStats:" << std::endl;
for( unsigned int i = 0; i < viewer.getNumberOfCameras(); i ++ )
{
const Producer::Camera::FrameTimeStampSet &fs = viewer.getCamera(i)->getFrameStats();
char buff[64];
std::cout << "Camera " << i << ": " << std::endl;
// Rather than stand on my head to format iostream output
sprintf( buff, "%7.3lf", fs.getPipeStats( Producer::Camera::DrawTime ) );
std::cout << " Draw Time: " << buff << " milliseconds" << std::endl;
}
viewer.update();
viewer.frame();
}
viewer.sync();
return 0;
}
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
