Skip to content

Commit 7dce30e

Browse files
committed
Moved the viewer->update() to before the viewer->handleEvents() to ensure the event handlers updating the camera position use the latest node positions.
1 parent 2a7bd2e commit 7dce30e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

examples/nodes/vsgcoordinateframe/vsgcoordinateframe.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,6 @@ int main(int argc, char** argv)
893893
time += (time_pause + time_moving);
894894
}
895895

896-
vsg::write(cameraAnimationHandler->animation, "test.vsgt", options);
897-
898896
cameraAnimationHandler->play();
899897

900898
viewer->addEventHandler(cameraAnimationHandler);
@@ -928,19 +926,19 @@ int main(int argc, char** argv)
928926
auto commandGraph = vsg::CommandGraph::create(window, renderGraph);
929927

930928

931-
932929
viewer->assignRecordAndSubmitTaskAndPresentation({commandGraph});
933930

934931
viewer->compile();
935932

936933
// rendering main loop
937934
while (viewer->advanceToNextFrame() && (numFrames < 0 || (numFrames--) > 0))
938935
{
936+
// update all the node positions, do this first as event handlers update the camera based on these positions
937+
viewer->update();
938+
939939
// pass any events into EventHandlers assigned to the Viewer
940940
viewer->handleEvents();
941941

942-
viewer->update();
943-
944942
viewer->recordAndSubmit();
945943

946944
viewer->present();

0 commit comments

Comments
 (0)