Hi all, here's how I'm turning off vsync and it's not having any effect. Any
ideas. This setup is based on one of the examples, C++ / Windows / Vista.
I have dual monitors. Would that make any difference?
Thanks,
Bob
// Local Variable to hold window size data
RECT rect;
// Create the viewer for this window
m_pViewer = new CTOSOM_OSGViewer(this);
// Add a Stats Handler to the viewer
m_pViewer->addEventHandler(new osgViewer::StatsHandler);
m_pViewer->addEventHandler(new TOSOM_OSGkeyboardEventHandler);
// Get the current window size
::GetWindowRect(m_hWnd, &rect);
// Init the GraphicsContext Traits
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new
osg::GraphicsContext::Traits;
// Init the Windata Variable that holds the handle for the Window to
display OSG in.
osg::ref_ptr<osg::Referenced> windata = new
osgViewer::GraphicsWindowWin32::WindowData(m_hWnd);
// Setup the traits parameters
traits->x = 0;
traits->y = 0;
traits->width = rect.right - rect.left;
traits->height = rect.bottom - rect.top;
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
traits->setInheritedWindowPixelFormat = true;
traits->inheritedWindowData = windata;
traits->vsync = false;
// Create the Graphics Context
osg::GraphicsContext* gc =
osg::GraphicsContext::createGraphicsContext(traits.get());
// Init a new Camera (Master for this View)
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
// RLY set CullingMode
camera->setCullingMode(osg::CullSettings::NO_CULLING);
// Assign Graphics Context to the Camera
camera->setGraphicsContext(gc);
// Set the viewport for the Camera
camera->setViewport(new osg::Viewport(traits->x, traits->y, traits->width,
traits->height));
// RLY - set ortho projection
camera->setProjectionMatrixAsOrtho(-5000, 5000, -5000, 5000, -5000,
5000);
// Add the Camera to the Viewer
m_pViewer->addSlave(camera.get());
// Add the Camera Manipulator to the Viewer
m_pViewer->setCameraManipulator(m_pswitchManipulator.get());
// Set the Scene Data
m_pViewer->setSceneData(m_pRoot.get());
// Realize the Viewer
m_pViewer->realize();
}
-----Original Message-----
From: Ulrich Hertlein [mailto:[email protected]]
Sent: Saturday, July 11, 2009 8:26 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] frame rate faster than monitor vsync?
Hi Bob,
On 10/7/09 9:05 PM, Bob Youmans wrote:
> Hi, does anyone know if it’s possible to run faster than the 60Hz vsync
> or 100Hz osg limit, if computational performance is the ultimate goal
> even at the expense of “tearing.” Can I get 600 fps by turning off vsync
> (or something else, it didn’t work on my box)? Is the graphics card
> driver/model involved? How can you tell which ones will work without
> actually buying it?
If you turn off vsync then OSG will render as fast as possible, without any
artificial
limitation. There's no 100 Hz OSG limit that I'm aware of except maybe in the
DB pager.
Sure you can get 600 fps if you're willing to accept tearing (or render
offscreen), even
my GeForce 8600M GT laptop gives me over 1000 fps for moderately complex
models. And yes,
the graphics card is obviously involved (the faster the better) and so is the
driver.
If you're not seeing more than vsync fps then the reason is most likely due to
setup, e.g.
a driver settings forcing vsync on or __GL_SYNC_TO_VBLANK being set on Linux.
Cheers,
/ulrich
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org