Commit Graph

225 Commits

Author SHA1 Message Date
Robert Osfield
9404abfef5 Added className() implementation to help wiht debugging. 2010-02-16 17:38:49 +00:00
Robert Osfield
56b384d880 From Jan Peciva, "I am sending one more improvement (separately from Inventor plugin).
I found very useful to have a control whether osgView::setCameraManipulator does or does not reset camera to home position.

I extended method signature as follows:
void setCameraManipulator(osgGA::MatrixManipulator* manipulator, bool resetPosition = true);

keeping the current usage intact (default parameter), while enabling user to disable the position reset. That can be useful in the situation when manipulator position was already loaded, for example from a file (user specification), or defined any other way, while we do not want to be reset to home position. Other usability is usage of two manipulators in a modeling program (orbiting around the model, walking on the model) and changing between them while we want to preserve the position of a camera in the change. Games may benefit from it as well when we change from user-defined helicopter manipulator to soldier manipulator because the user escaped the helicopter. The camera will change manipulator but the position is expected to be kept in the transition (provided that user makes the state transition between the two manipulators himself).
"
2010-01-26 15:08:25 +00:00
Robert Osfield
cb7181b7a5 Removal of redundant spaces at ends of lines 2010-01-26 14:57:44 +00:00
Robert Osfield
b7b86ba5f4 From Stephan Huber, "attached you'll find the missing GraphicsHandleCocoa-implementation." 2009-12-10 17:52:40 +00:00
Robert Osfield
3a6a756d34 Converted tabs to four spaces 2009-12-07 12:35:33 +00:00
Robert Osfield
71af49f934 Added missing createContextImplementation(). 2009-11-22 17:27:13 +00:00
Robert Osfield
4759cb951e From Colin MacDonald, "In my application I have a custom graphics context class, derived from
osg::GraphicsContext, in order to give good integration with the
application's GUI toolkit.  This works really well.

However, I need to share OpenGL texture resources with the standard
osgViewer GraphicsContext implementations, in particular the
PixelBuffers.  This is essential for my application to conserve graphics
memory on low-end hardware.  Currently the standard osg implementations
will not share resources with another derived osg::GraphicsContext,
other than the pre-defined osgViewer classes e.g. PixelBufferX11 is
hardcoded to only share resources with GraphicsWindowX11 and
PixelBufferX11 objects, and no other osg::GraphicsContext object.

To address this in the cleanest way I could think of, I have moved the
OpenGL handle variables for each platform into a small utility class,
e.g. GraphicsHandleX11 for unix.  Then GraphicsWindowX11, PixelBufferX11
and any other derived osg::GraphicsContext class can inherit from
GraphicsHandleX11 to share OpenGL resources.

I have updated the X11, Win32 and Carbon implementations to use this.
The changes are minor.  I haven't touched the Cocoa implmentation as
I'm not familiar with it at all and couldn't test it - it will work
unchanged.

Without this I had some horrible hacks in my application, this greatly
simplifies things for me.  It also simplifies the osgViewer
implementations slightly.  Perhaps it may help with other users'
desires to share resources with external graphics contexts, as was
discussed on the user list recently."

Notes from Robert Osfield, adapted Colin's submission to work with the new EGL related changes.
2009-11-21 16:41:02 +00:00
Robert Osfield
b4a5edd82e From Jean-Sebastien Guay, "I've made a change to the ScreenCaptureHandler's addCallbackToViewer method, so that it iterates over GraphicsContexts instead of GraphicsWindows. When the viewer has a pbuffer (for offscreen rendering without a window) then it wouldn't add the WindowCaptureCallback to that context since it wasn't in the list returned by ViewerBase::getWindows(). And anyways, I originally wrote the code, and I didn't see any reason why I did it with windows instead of contexts...
I've needed to run a recorded simulation offscreen and save it to a sequence of images, and the ScreenCaptureHandler seemed to be the simplest way to do that, and with this change it's possible.


Another change: I've also added the ability to specify continuous capture of all frames, or a certain number of frames. ScreenCaptureHandler now has a setFramesToCapture(int) method. The argument will be interpreted as:

0  : don't capture
<0 : capture continuously
>0 : capture that number of frames then stop

I also added startCapture() and stopCapture() methods so that user code can start capturing (either continuously or the given number of frames) at a given point in their program. setFramesToCapture() won't start capturing, you have to call startCapture() afterwards. The handler also now has another key to toggle continuous capture (defaults to 'C').

Note that continuous capture will of course only work if the CaptureOperation writes to different files (for example, a WriteToFile with SEQUENTIAL_NUMBER mode) or does something different each time... Otherwise it will just overwrite of course. :-)

I've also taken the chance to refactor the addCallbackToViewer() method a bit too, since finding the right camera is needed in two places now.

I've tested all cases (I think). If you want to try, in osgviewer.cpp and replace the line

 // add the screen capture handler
 viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);

with

 // add the screen capture handler
 osgViewer::ScreenCaptureHandler* captureHandler = new
     osgViewer::ScreenCaptureHandler(
         new osgViewer::ScreenCaptureHandler::WriteToFile(
             "screenshot", "jpg",
     osgViewer::ScreenCaptureHandler::WriteToFile::SEQUENTIAL_NUMBER),
     -1);
 viewer.addEventHandler(captureHandler);
 captureHandler->startCapture();

And vary the "-1" (put 0, 10, 50) and then use the 'c' and 'C' keys and see how it reacts.
"
2009-11-19 12:01:49 +00:00
Robert Osfield
4f6be906b3 Fixed spaces at ends of lines 2009-11-19 11:54:15 +00:00
Robert Osfield
6649f51ff2 From Paul Martz, osgViewer Win32 GL3 context creation support 2009-11-13 10:03:02 +00:00
Robert Osfield
a4639398e8 Fixed compile issue with Image.cpp and osgautocapture.cpp under GLES.
Fixed handling of EGLDisplay in EGL paths of GraphicsWindowX11
2009-11-01 09:04:41 +00:00
Robert Osfield
93d83010f8 Added EGL support into build system for GLES1 + GLES2.
Added EGL support into GraphicsWindowX11.
2009-10-30 15:17:38 +00:00
Robert Osfield
df9385ac19 Moved the updating and expiry of the Registry object cache from DatabasePager into osgViewer::Viewer/CompositeViewer. 2009-08-05 11:06:53 +00:00
Robert Osfield
c47c0c2a26 From Stephan Huber, "ttached you'll find a small fix for the
GraphicsWindowCocoa-implementation, which enhances multithreaded
stability, it ensures that modifications to the size of an openglcontext
is done only from one thread.
"
2009-07-13 08:30:20 +00:00
Robert Osfield
6a269e24e5 From Stephan Huber, "attached you'll find some bugfixes and enhancements for the Cocoa
implementation of GraoicsWindowCocoa:

Enhancements/Bugfixes:

+ now it's possible to integrate osgViewer better into existing
cocoa-applications:
* create one or more NSOpenGLView(s) and add these to your window(s)
* create one or more NSWindows
* disable the integrated event-polling of osgViewer, and let the work be
done by Cocoa / NSApplicationRun. You'll have to run the osgViewer's
runloop in a separate thread

+ missing menu-event-handling implemented

+ added NSAutoReleasePools where necessary, this fixes some memory-leaks
+ fixed some crashes and thread-issues"
2009-05-14 15:34:15 +00:00
Robert Osfield
7ea1a97afd From Frederic Bouvier, SetCursor fixes from GraphicsWindowWin32,
Original email from Frederic at start of thread:
"he patch attached, made from r10068, fix two things, in other of importance :

- the selected cursor is never shown ( second change in file ). Only the left arrow is always displayed.
- remove the arbitrary ( in my sense ) limitation that the user cannot choose a cursor with the same shape that one used when resizing the window. This limitation doesn't exist for X11, and we have a diverging behaviour there ( first change in file ). Flightgear use the LeftRightCursor in look around mode."

Follow up email from Frederic (with changes that finally made it into this check in:
"I've just tested Mark's suggestion and it works perfectly, even when the
cursor goes to the border then come back inside the window.
But his patch doesn't seem to be based on the last revision of the
files, or at least not on the trunk, and there are more changes than
expected in them, including some loss from the previous patches.
The patch attached is based on r10068 of
src/osgViewer/GraphicsWindowWin32.cpp and r10067 of
include/osgViewer/api/Win32/GraphicsWindowWin32"
2009-05-07 13:30:54 +00:00
Robert Osfield
a50f0ccfaf Introduce new run frame rate management support to allow control of maximum frame rate and to support on demand rendering of frames 2009-04-24 16:20:50 +00:00
Robert Osfield
616a96343c From Neil Hughes, "Please find attached two files that I've amended to add the IDC_HAND cursor for the windows platform." 2009-04-22 11:20:19 +00:00
Robert Osfield
b6182a1239 From Peter Amstutz, "Here is a simple change to osgViewer::GraphicsWindowWin32 to add a flag to WindowData to specify that the graphics window should not install an event handler of its own, per this discussion thread:
http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg23734.html

The change is source compatible with current osg code and will not affect current users, it simply adds an additional parameter to the GraphicsWindowWin32::WindowData struct constructor and defaults to the current behavior.

Attached are the files "include/osgViewer/api/Win32/GraphicsWindowWin32" and "src/osgViewer/GraphicsWindowWin32.cpp" with my changes, based on svn revision 10045.  In addition, I have provided an svn patch file with the same changes for your convenience.

I have discussed the matter with my supervisor, and agreed that my company makes no copyright claim over this extremely trivial change (or to put it another way, we assign copyright to the open scene graph community.)"
2009-04-22 11:12:03 +00:00
Robert Osfield
7b5f3ec92a Moved IncrementalCompileOperation out of include-src/osgUtil/GLObjectVisitor into their own files.
Added support to IncrementCompileOperation for controlling how much time is alloted to compilation and flush
2009-03-12 15:21:04 +00:00
Robert Osfield
998cfec137 Added View::removeEventHandler(..) method and added check into addEventHandler() to prevent handlers being added twice. 2009-03-11 14:18:30 +00:00
Robert Osfield
771f3a3238 From Stephan Huber, files were are missed by Robert in check in of changes to GraphicsWindowCarbon.cpp 2009-03-11 12:55:20 +00:00
Robert Osfield
5059aa808b From Stephan Huber, support for Cocoa windowing under OSX. 2009-03-10 10:13:20 +00:00
Robert Osfield
7473b06275 Preliminary work on general purpose incremental compile support in osgViewer. 2009-03-08 12:00:36 +00:00
Robert Osfield
17241da4e5 Added explict initialization of osg::Object contstructor to fix warning 2009-02-03 11:04:37 +00:00
Robert Osfield
81b336756b Added explict intializiers of base classes 2009-02-02 17:32:34 +00:00
Robert Osfield
e1bdee5338 Improved handling of stats projection size 2009-02-02 17:15:40 +00:00
Robert Osfield
29157f24d9 Refactored the view stats. 2009-01-27 13:23:20 +00:00
Robert Osfield
98bd058317 Fixed warnings 2009-01-07 10:32:59 +00:00
Robert Osfield
2cc53e2256 Moved main setSceneData methods in osgViewer::View::setSceneData() 2008-12-19 17:50:58 +00:00
Robert Osfield
502eced994 From Jean-Sebastein Guay, I recently had to reimplement screen capture functionality into our framework (which was broken since the switch from OSG 1.2 to 2.2 over a year and a half ago). I used the ScreenCaptureHandler which I had contributed right before OSG 2.6 shipped, bit I had to trigger the screen capture programatically instead of by a key press in some cases, so I added a convenience method to do that.
It's a minimal change, it just calls an already existing protected method. It was trivial to subclass the handler to do it in our code, but pushing the change into OSG makes sense as it's generally useful to have it in the handler itself.

I also noticed that the handle() method was overridden from osgGA::GUIEventHandler but wasn't marked virtual. It wasn't intended that subclasses not be able to override it in turn, so I've added the keyword.""
2008-12-19 17:15:10 +00:00
Robert Osfield
946175385f From Ulrich Hertlein, Typo fixes + "optional parameter to RecordCameraPathHandler to control the frame rate for record/playback. Default is 25.0, the environment variable takes preference if set." 2008-12-12 13:41:39 +00:00
Robert Osfield
5363736caa Refactored computeIntersections() float x,float y, const osg::NodePath& nodePath. 2008-12-10 11:12:37 +00:00
Robert Osfield
6f356aeb97 Intoduce new osgWidget::PdfReader and osgWidget::VncClient front ends to osgWidget,
with new pdf plugin and updated vnc plugin that now support these front ends.

Updated osgpdf and osgvnc examples to new these new interfaces.
2008-12-07 17:02:30 +00:00
Robert Osfield
5b15436935 Added mechanism for tracking when interactive images are being rendered to
enable their backends to only rendered them when they are actively being rendered
in the OpenGL window.
2008-11-23 15:51:43 +00:00
Robert Osfield
eaba09027e Reverted Kyle Centers mistaken patch that removed a _currentContext->valid() that was actually required. 2008-11-19 20:34:53 +00:00
Robert Osfield
10b5f0d041 From Wojciech Lewandowski, "Attached are modifications to GraphicsWindowWin32. By default workaround is
set to off. But could be activated/decativated via CMake as well as system
environment variable. I also modified src\osgViewer\CMakeLists.txt to turn
off this workaround by default as suggested."
2008-11-14 17:03:59 +00:00
Robert Osfield
60af3fd6fc Fixed typo 2008-11-07 17:23:55 +00:00
Robert Osfield
720551d549 From Michael Platings, Converted std::fstream/ifstream/ofstream to osgDB::fstream/ifstream/ofstream and
fopen to osgDB::fopen to facilitate support for wide character filenames using UT8 encoding.
2008-11-07 15:08:08 +00:00
Robert Osfield
4f5379389d From Martins Innus, "Here is a fix to add requestWarpPointer for OS X. It seems to work for me, I just took what osgProducer had. These are updated files to 2.7.3" 2008-11-07 10:23:57 +00:00
Robert Osfield
3f9e5dbfaa From Kyle Centers, removed redundent check to _currentContext.valid(). 2008-11-06 14:17:12 +00:00
Robert Osfield
70e1c60819 Added sendPointerEvent and sendKeyEvent virtual methods to osg::Image to
facilitate the subclassing of Image providing interactive behaviours so as
used in the vnc interactive VncImage class.

osgViewer::InteractiveImageHandler provides an event handler that convertes osgGA 
mouse and keyboard events into the coordinate frame of an image based on ray intersection with geometry in
the associated subgraph.

Changed the ordering of events processing in Viewer and CompositeViewer to allow
scene graph event handlers to take precidence over viewer event handlers and camera manipulators
2008-11-03 15:08:04 +00:00
Robert Osfield
4bde492d8c From Stephan Huber, removed now redundent setEventQueue method 2008-10-03 09:19:53 +00:00
Robert Osfield
fb9181ff17 From Roland Smeenk, A year ago Stephan Maximilian Huber sent in a submission with enhanced statistics. Because I was interested in the scene statistics of his submission I tried to merge his changes with the current CVS head. I made a few changes to the way the statistics are displayed. Attached you will find the new StatsHandler and a screenshot of the statistics in the compositeviewer example.
This code will add two extra statistics options:
-Camera scene statistics, stats for the scene after culling (updated at 10 Hz)
-View scene statistics, stats for the complete scene (updated at 5 Hz)
 
Each camera and each view will expand the statistics to the right.
 
I also added the requests and objects to compile of the databasepager to the databasepager statistics.""
2008-10-03 09:02:23 +00:00
Robert Osfield
91f7895735 refactored the getWindows(..) and getContexts(..) methods so that they produce
consistent ordering based on the order Camera/slave camera ordering.
2008-09-18 15:18:59 +00:00
Robert Osfield
dceb3cbe88 From Jutta Sauer, "We added a raise window method to GraphicsWindow. And added two
implementations for Win32 and X11.

"
2008-08-15 17:32:26 +00:00
Robert Osfield
f81ff952a2 merged 2.6 branch changes back into trunk using : svn merge -r 8699:8706 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches/OpenSceneGraph-2.6 . 2008-08-03 16:57:09 +00:00
Robert Osfield
19e3b1624d Moved osgViewer::ScreenCaptureHandler's WindowCaptureCallback from head into .cpp
to clean up headers and avoid wrapper build issues.

Updated wrappers
2008-07-21 23:42:59 +00:00
Robert Osfield
cad2f6d4fc From Jean-Sebastien Guay, "Changes attached so that the CaptureOperation is passed in the constructor of the ScreenCaptureHandler (default 0 = default CaptureOperation). This way, you can do:
viewer.addEventHandler(new osgViewer::ScreenCaptureHandler(
   new osgViewer::WriteToFileCaptureOperation("filename", "jpg")));

and the filename will be what you want. The WriteToFileCaptureOperation will add the context ID and the file number (if in SEQUENTIAL_NUMBER mode) to the file name.

(The attached also clarifies some notify messages, and corrects the comment when adding the handler in osgviewer.cpp)

I also remembered, the current architecture could allow a different CaptureOperation for each context, but currently the API only allows setting one CaptureOperation for all contexts. This could be improved if need be.

"
2008-07-21 21:28:48 +00:00
Robert Osfield
d12708e6f6 First cut of osgDB::ImagePager for updating osg::ImageSequence 2008-07-21 09:47:39 +00:00