Need to add
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()));
Press w can switch the display mode.
In which the viewer is osg :: Viewer, different from osg :: view.
Because the display view can also add node, but can not be converted Viewer view, the message is invalid in response to the mouse and keyboard.