You could do a setenv(..), in you code on startup
Gordon Tomlinson Chief Engineer(Remoteview) Overwatch An Operating Unit of Textron Systems __________________________________________________________ -----Original Message----- From: osg-users-boun...@lists.openscenegraph.org [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of clement....@csiro.au Sent: Monday, February 27, 2012 6:27 AM To: osg-users@lists.openscenegraph.org Subject: Re: [osg-users] How to detect rotating image Hi Robert, Thanks for your suggestion. I checked the source code viewerbase.cpp. There is attribute called _runFrameScheme, but the value is assigned by getenv("OSG_RUN_FRAME_SCHEME"). Except to set the environment variable, any method I can assign the value to _runFrameScheme? Thanks. Regards, Clement ________________________________________ From: osg-users-boun...@lists.openscenegraph.org [osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert Osfield [robert.osfi...@gmail.com] Sent: Monday, 27 February 2012 9:55 PM To: OpenSceneGraph Users Subject: Re: [osg-users] How to detect rotating image Hi Clement, The osgViewer::ViewerBase (base class for Viewer) has a FrameScheme hint for the run() method which enables ON_DEMAND or CONTINUOUS, ON_DEMAND is the approach you'd want. You'll be calling frame() yourself rather than run() so won't be able to utilize this feature, but you should be able to learn from it. Have a look at the ViewerBase::run() method in OpenSceneGraph/src/osgViewer/ViewerBase.cpp, in particular the use of checkNeedToDoFrame() which is used to decide whether a frame is needed or not. Robert. On 27 February 2012 09:57, <clement....@csiro.au> wrote: > Hi Robert, > > I mentioned before I got much cpu usage on MFC window. In osgMFC example, > it uses a thread and for loop to keep calling _osgViewer->frame(). It is a > reason why the cpu keeps loading and it also depended on how large of volume > data loaded. Now I have changed to call frame() on MFC OnPaint event. It can > decrease much cpu usage. I also added to call frame() on mouse move, mouse > wheel and size events for zooming and rotating the image. But all MFC events > cannot be fired if the image is rotating by itself. Thus, I am thinking > whether osg has an event to detect the image is rotating. > > I just found a solution to add MFC mouse button up and down to detect > whether the user wants to rotate the image. Then I can do it all on MFC > event. > > > Regards, > Clement > ________________________________________ > From: osg-users-boun...@lists.openscenegraph.org > [osg-users-boun...@lists.openscenegraph.org] On Behalf Of Robert > Osfield [robert.osfi...@gmail.com] > Sent: Monday, 27 February 2012 8:17 PM > To: OpenSceneGraph Users > Subject: Re: [osg-users] How to detect rotating image > > Hi Clement, > > On 27 February 2012 06:26, <clement....@csiro.au> wrote: >> I would like to know how to detect the image is rotating. For example, we >> can use the mouse to rotate the image on viewer. If we drag on the viewer, >> the image will automatically rotate. Any event I can get the image is >> rotating by itself? Thanks. > > It's not possible to know precisely what you mean given the above. > What exactly do you mean by image? A texture on a quad? The whole > framebuffer? Are we talking about an object in the scene graph being > rotated by a transform, or simply an object moving because the camera > is moving. > > Robert. > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph. > org _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph. > org _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org