Commit Graph

292 Commits

Author SHA1 Message Date
Robert Osfield
68f37c4dcb From Tim More and Robert Osfield, implementation of ARB_timer_query based GPU timing stats syncronization.
Initial email from Tim : "I've implemented using a timestamp, available with ARB_timer_query and OpenGL 3.3, to gather GPU stats. This is nice because it can accurately fix the GPU draw time with respect to the other times on the stats graph, rather than having to estimate the wall time of the end of GPU drawing. This also prevents anomalies like the GPU phase starting before the draw phase..."
Changes to Tim's submission by Robert:  Removal of need for swap buffer callback in ViewerBase.cpp, by
integrating a osg::State::frameCompleted() method that does the stats timing collection.  Introduction of a
GraphicsContext::swapBuffersCallbackOrImplementation() method that calls the State::frameCompleted() and
the swap buffers callback or the swapImplementation as required.
2010-11-10 16:58:58 +00:00
Robert Osfield
be583ef0d6 From Jean-Sebastien Guay, "As promised, here is the fix for the background size. I also added another instance variable _lineHeight to clean up the code a bit more.
Also I've done the osguserstats example. I've kept the "toy example" that was in the modified osgviewer.cpp I had sent you, because they show different uses of custom stats lines (a value displayed directly, a value without bars and a value with bars and graph). I also added a function and a thread that will sleep for a given number of milliseconds and record this time in the stats. I think it clearly shows how to record the time some processing takes and add that to the stats graph, whether the processing takes place on the same thread as the viewer or on another thread.

BTW, feel free to modify the colors I've given to each user stats line... I'm not very artistic. :-)

I've also added more doc comments to the addUserStats() method in ViewerEventHandlers, so hopefully the arguments are clear and the way to get the results you want is also clear. Maybe I went overboard, but the function makes some assumptions that may not be obvious and has many arguments, so I preferred to be explicit."
2010-11-08 12:28:31 +00:00
Robert Osfield
1beedce6fc From Jean-Sebastien Guay, "For a long time now I've wanted to be able to add custom values into the stats handler's graph. Here is my proposal of how I'd do this. It's surely not perfect and I'm open to suggestions, but I've already made more changes than I wanted to in order to be able to implement this...
The user calls statsHandler->addUserStatsLine() providing:

- the label they want for that line in the graph
- the text and bar colors they want in the graph
- the stats names they want queried (one for time taken, one for begin and one for end time) and a few settings for how these will be displayed.

Then all they have to do is call viewer->getViewerStats()->setAttribute(framenumber, name, value) for their three attributes each frame and they'll have their stats in the graph.

They can also give only a time taken attribute (or some other numerical value they want printed, which can be averaged or not), or only begin+end attributes, and the graph will accordingly display only the (average or not) numerical value or only the bars.

Along the way I cleaned up the existing code a bit:

* Each time the setUpScene() or createCameraTimeStats() methods added a line to the graph, they did pretty much the same thing, so I moved that into a separate method called createTimeStatsLine() which is called by setUpScene() and createCameraTimeStats().

* I moved the font, characterSize, startBlocks and leftPos variables to member variables, since they were being passed around everywhere but were set only once at the beginning.

* The geode on which stats lines are added is also kept in a member variable, and createCameraTimeStats() adds the per-camera lines to this geode instead of returning a new Group with a new Geode. This further reduces the number of variables the createCameraTimeStats() method needs as input.

"
2010-11-03 10:04:34 +00:00
Robert Osfield
0d347352cf From David Guthrie, "The cocoa version of the window for Mac OS X doesn't implement the requestWarpPointer function, but it turns out that the code from the Carbon version of the window is the same because it uses the windowing interface, so it this version, based on 2.8.3 GraphicsWindowCocoa, I copied the function over. The trunk version it also missing the function and the code looks to be very similar, so I assume it will transfer simply enough.
"
2010-09-21 10:28:50 +00:00
Robert Osfield
b0db0382f5 Reverted changes from Vivien Delage as there were some regressions discovered. Will need to revist this code to deal with bugs that Vivien was tackling. 2010-09-17 13:09:23 +00:00
Robert Osfield
cc471b1103 From Magnus Kessler, "Attached are a number of files where I have tried to fix up some of the
documentation. I have accumulated them over some time, but rebased onto the
subversion trunk."
2010-09-15 12:00:12 +00:00
Robert Osfield
78cb15fdf8 From Torben Dannhauer, "I extended the attached CMAKE module to search for the collada libraries of my VS2008 3rdParty package if no other library is found.
No CMAKE should recognize all libraries of the VS2008 3rdParty Package."
2010-09-09 10:44:11 +00:00
Robert Osfield
77c35eabde From Jean-Sebastien Guay, "I've added a second ctor where no argument is optional, and documented that it's meant to be used when the InteractiveImage is going to be used in a fullscreen HUD.
"
2010-09-09 09:47:31 +00:00
Robert Osfield
9d9a36f6af From Brad Christiansen, "The small change I have made (against this morning's trunk) enables subclasses to register and unregister windows via protected methods. I need this access as I have a subclass that handles some of the oddities of mixing a native OpenGL window with Java's windowing system. I doubt there will be much general benefit of the modification but it should also not be harmful in any way to others." 2010-06-28 08:24:53 +00:00
Robert Osfield
6cbce93aa4 From Jean-Sebastien Guay, "I've been working in the last few days
to get QWidgetImage to a point where it can fill a need we have: to be
able to use Qt to make HUDs and to display widgets over / inside an OSG
scene.

---------------
Current results
---------------
I've attached what I have at this point. The modified QWidgetImage +
QGraphicsViewAdapter classes can be rendered fullscreen (i.e. the Qt
QGraphicsView's size follows the size of the OSG window) or on a quad in
the scene as before. It will let events go through to OSG if no widget
is under the mouse when they happen (useful when used as a HUD with
transparent parts - a click-focus scheme could be added later too). It
also supercedes Martin Scheffler's submission because it adds a
getter/setter for the QGraphicsViewAdapter's background color (and the
user can set their widget to be transparent using
widget->setAttribute(Qt::WA_TranslucentBackground) themselves).

The included osgQtBrowser example has been modified to serve as a test
bed for these changes. It has lots more command line arguments than
before, some of which can be removed eventually (once things are
tested). Note that it may be interesting to change its name or split it
into two examples. Though if things go well, the specific QWebViewImage
class can be removed completely and we can consolidate to using
QWidgetImage everywhere, and then a single example to demonstrate it
would make more sense, albeit not named osgQtBrowser... You can try this
path by using the --useWidgetImage --useBrowser command line arguments -
this results in an equivalent setup to QWebViewImage, but using
QWidgetImage, and doesn't work completely yet for some unknown reason,
see below.

----------------
Remaining issues
----------------
There are a few issues left to fix, and for these I request the
community's assistance. They are not blockers for me, and with my
limited Qt experience I don't feel like I'm getting any closer to fixing
them, so if someone else could pitch in and see what they can find, it
would be appreciated. It would be really nice to get them fixed, that
way we'd really have a first-class integration of Qt widgets in an OSG
scene. The issues are noted in the osgQtBrowser.cpp source file, but
here they are too:

-------------------------------------------------------------------
  QWidgetImage still has some issues, some examples are:

  1. Editing in the QTextEdit doesn't work. Also when started with
     --useBrowser, editing in the search field on YouTube doesn't
     work. But that same search field when using QWebViewImage
     works... And editing in the text field in the pop-up getInteger
     dialog works too. All these cases use QGraphicsViewAdapter
     under the hood, so why do some work and others don't?

     a) osgQtBrowser --useWidgetImage [--fullscreen] (optional)
     b) Try to click in the QTextEdit and type, or to select text
        and drag-and-drop it somewhere else in the QTextEdit. These
        don't work.
     c) osgQtBrowser --useWidgetImage --sanityCheck
     d) Try the operations in b), they all work.
     e) osgQtBrowser --useWidgetImage --useBrowser [--fullscreen]
     f) Try to click in the search field and type, it doesn't work.
     g) osgQtBrowser
     h) Try the operation in f), it works.

  2. Operations on floating windows (--numFloatingWindows 1 or more).
     Moving by dragging the titlebar, clicking the close button,
     resizing them, none of these work. I wonder if it's because the
     OS manages those functions (they're functions of the window
     decorations) so we need to do something special for that? But
     in --sanityCheck mode they work.

     a) osgQtBrowser --useWidgetImage --numFloatingWindows 1
                     [--fullscreen]
     b) Try to drag the floating window, click the close button, or
        drag its sides to resize it. None of these work.
     c) osgQtBrowser --useWidgetImage --numFloatingWindows 1
                     --sanityCheck
     d) Try the operations in b), all they work.
     e) osgQtBrowser --useWidgetImage [--fullscreen]
     f) Click the button so that the getInteger() dialog is
        displayed, then try to move that dialog or close it with the
        close button, these don't work.
     g) osgQtBrowser --useWidgetImage --sanityCheck
     h) Try the operation in f), it works.

  3. (Minor) The QGraphicsView's scrollbars don't appear when
     using QWidgetImage or QWebViewImage. QGraphicsView is a
     QAbstractScrollArea and it should display scrollbars as soon as
     the scene is too large to fit the view.

     a) osgQtBrowser --useWidgetImage --fullscreen
     b) Resize the OSG window so it's smaller than the QTextEdit.
        Scrollbars should appear but don't.
     c) osgQtBrowser --useWidgetImage --sanityCheck
     d) Try the operation in b), scrollbars appear. Even if you have
        floating windows (by clicking the button or by adding
        --numFloatingWindows 1) and move them outside the view,
        scrollbars appear too. You can't test that case in OSG for
        now because of problem 2 above, but that's pretty cool.

  4. (Minor) In sanity check mode, the widget added to the
     QGraphicsView is centered. With QGraphicsViewAdapter, it is not.

     a) osgQtBrowser --useWidgetImage [--fullscreen]
     b) The QTextEdit and button are not in the center of the image
        generated by the QGraphicsViewAdapter.
     c) osgQtBrowser --useWidgetImage --sanityCheck
     d) The QTextEdit and button are in the center of the
        QGraphicsView.
-------------------------------------------------------------------

As you can see I've put specific repro steps there too, so it's clear
what I mean by a given problem. The --sanityCheck mode is useful to see
what should happen in a "normal" Qt app that demonstrates the same
situation, so hopefully we can get to a point where it behaves the same
with --sanityCheck and without."
2010-06-15 13:57:44 +00:00
Robert Osfield
3cc90b8fd3 Fixed permissions 2010-06-03 15:07:21 +00:00
Robert Osfield
d746f11650 Renamed osgGA::MatrixManipualtor to osgGA::CameraManipulator so its name better reflects it's function 2010-05-27 15:54:37 +00:00
Robert Osfield
9eebb2eb23 From Ulrich Hertlien with little bits from Robert Osfield and Chris Hanson, added provisionl support for controlling sync to vblank. 2010-04-21 17:16:13 +00:00
Robert Osfield
c0e9fcbb67 From Tim Moore, "This contains a couple of fixes to support changing FrameBufferObject configurations on the fly; the user changes the camera attachments and calls Renderer::setCameraRequiresSetUp(). The major part of this submission is a comprehensive example of setting up floating point depth buffers. The user can change the near plane value and cycle through the available combinations of depth format and multisample buffer formats." 2010-04-19 11:43:06 +00:00
Robert Osfield
ecf7a7e3e4 From Stephan Huber, "attached you'll find a small enhancement for GraphicsWindowCocoa. My
submision adds a getter for the pixel-format. I need this for some
custom software so I can integrate CoreVideo-playback with osg.
"
2010-03-25 14:14:46 +00:00
Robert Osfield
7f454bef3e Converted View across to use ObserverNodePath. 2010-02-20 17:36:55 +00:00
Robert Osfield
43f9b13199 Removed the uncessary subclassing from osg::Object as this base class is already pullled via ViewerBase 2010-02-19 18:56:21 +00:00
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
Robert Osfield
46796978fd From Jean-Sebastien Guay and Robert Osfiled, osgViewer::ScreenCaptureHandler for
taking screenshots
2008-07-17 16:12:39 +00:00
Robert Osfield
4aed0a7eac From Ulrich Hertlein, "attached are some minor tweaks:
- fixed typos in osgViewer/ViewerBase
- const-ness in include/osg/View findSlaveIndexForCamera
- supported options for STL reader, fixed return values to reflect proper errors
- supported options for DirectX reader, fixed return values
- normals pseudo-loader: scaling normals to a const (but variable) fraction of the bounding sphere radius
"
2008-07-17 13:51:14 +00:00
Robert Osfield
dd137c2442 From Bob Kuehne, "this submission extends the osgViewer::RecordCameraPathHandler to have an optionally-enabled auto-incrementing filename. default behavior is still the same, but there's one new method to enable autoincrementing filenames."
From Robert Osfield, modified the above so that the number increments come after the filename rather than before.
2008-06-18 11:13:51 +00:00
Robert Osfield
282fa84789 Added support for optionally calling releaseContext at the end of each
renderinTraversals() to help with cases where uses are driving multiple
contexts from mulitple viewers in a single threaded frame loop.
2008-06-04 16:46:14 +00:00
Robert Osfield
e09e07d45b Added support for assigning GraphicsContext to individual GUIEventAdapter events,
and use of this within osgViewer::View to better track the sources of events.
2008-06-02 17:34:47 +00:00
Robert Osfield
cac6e2facb Added continuous recording of the animation path to the RecordAnimationPathHandler 2008-05-26 17:30:43 +00:00
Robert Osfield
4d7b2edd4c Moved compile setup from osgViewer::ViewerBase into osgViewer::Renderer to
avoid threading issues associated with compile running in a parallel with 
update/cull on the first frame.

Also added automatic recompile when a new SceneData is applied to a View.
2008-05-10 17:04:02 +00:00
Robert Osfield
9e6c3a7628 From Melchior Franz, "In KDE I switch desktops with Super-Tab, and occasionally I
get an excess Tab key report when switching back to an OSG
application (usually FlightGear :-). Although KDE has consumed
the Tab, it's sometimes still in the XKeymapEvent's key_vector,
and followed by a Tab KeyRelease event.

Avoid this artifact by
- asking for a "fresh" keymap (via XQueryKeymap()), rather than
 using the unreliable(?) XKeymapEvent's key_vector, and by
- flushing all key events on focus-in (to avoid the KeyRelease)

After Super-press, Tab-press, Super-release, Tab-release (note
the wrong release order!) I still get an extra Tab event. But
this is not surprising and not exactly wrong either. Also it's
hard to avoid, as we can't see what happened to the keyboard
before we regained focus.

Files changed:
 src/osgViewer/GraphicsWindowX11.cpp
 include/osgViewer/api/X11/GraphicsWindowX11"
2008-05-08 16:45:59 +00:00
Robert Osfield
96f2062115 From Miguel Escriva, "Attached to this mail you will find some files to work with the Philips WOWvx displays.
It's implemented in the same way that 3D Spherical Display and Panoramic Spherical Display.

You can test it running:
   osgviewer --wowvx-20 cow.osg
   osgviewer --wowvx-42 cow.osg
depending on the size of your Philips WOWvx display (20" or 42")

Other arguments you can use to control the 3D effect are:

--wow-content <value>
   This value defines the kind of content that can be:
      0: No depth
      1: Signage
      2: Movie
      3: CGI
      4: Still

--wow-factor <value>
   Percentage of the display recommended depth value. Default 64, Range [0-255]

--wow-offset <value>
   Amount of range behind the screen. Default 128, Range [0-255]
      0: Range is shifted in the direction of the viewer.
      128: Range is equally divided in front and behind the screen.
      255: Range is shifted away from the viewer.
      "
2008-05-07 14:17:15 +00:00
Robert Osfield
922dcb0423 Added new computation of time to allocate to flushing deleted and compiling OpenGL objects per frame. 2008-04-16 18:13:41 +00:00
Robert Osfield
e24d351cc4 From Jason Beverage, cursor inheritance support 2008-04-16 10:01:16 +00:00
Robert Osfield
f9f7770336 From Tatsuhiro Nishioka and Stephan Huber, bug fixes and enhancement of cursor suppoort. 2008-04-01 10:00:39 +00:00
Robert Osfield
f5f29a03c1 From Melchoir Franz, "osgViewer toggled the NumLock state correctly when pressing the NumLock
key, but it didn't pick up the initial state. So, if NumLock was on for
the OS at startup (LED on), it was still off for OSG. And the first
keypress turned the LED off, and NumLock on for OSG. The attached fix
picks up the state on every FocusIn, just like it was done in the last
commits for CapsLock. The difference is, that the NumLock mask isn't
standardized (e.g. 0x10 for Linux, and 0x80 for AIX), so we have to do
a reverse lookup (::rescanModifierMapping()).

Note that I could not reproduce the problem on my system, but someone
else confirmed it twice on his, and the patch fixed it for him.

Changed files:
 ./include/osgViewer/api/X11/GraphicsWindowX11
 ./src/osgViewer/GraphicsWindowX11.cpp

"
2008-03-19 21:05:38 +00:00
Robert Osfield
45bd3802de From Melchior Franz, "Attached is a fix for remaining problems in capslock handling:
It sets osgGA's keymask when restoring keys on FocusIn, according
to the state values of XKeyEvent and XCrossingEvent. (These are
the only source for X11's current capslock state that avoids
pulling in the XKB extension.)
"
2008-03-14 15:13:08 +00:00
Robert Osfield
e37bb89016 From Andy Skinner, build fix for Solaris 2008-03-14 11:01:54 +00:00
Robert Osfield
a460d66533 From Melchoir Franz, Caps lock support under X11 2008-03-13 16:12:46 +00:00
Robert Osfield
9d0c950bb0 From Colin McDonald, "Attached is an updated to osgViewer::PixelBufferWin32.
The win32 pbuffer implementation returned an error unless both the
WGL_ARB_pbuffer and the WGL_ARB_render_texture functions were present.
This was too restrictive, as a pbuffer can usefully be created without
render-to-texture, e.g. for use with glReadPixels.  The osg 1.2/Producer
pbuffers worked without RTT, and osgUtil::RenderStage has all the code to
handle both RTT and non-RTT pbuffers, doing a read and copy in the
latter case.

With these changes I have successfully tested the osgprerender example
on a graphics card which supports RTT, and one which doesn't.  Plus
tested in my own application.

In order to aid diagnostics I have also added more function status
return checks, and associated error messages.  I have included the win32
error text in all error messages output.  And there were some errors
with multi-threaded handling of "bind to texture" and a temporary window
context which I have corrected.

These is one (pre-existing) problem with multi-threaded use of pbuffers
in osgViewer & osgprerender, which I have not been able to fix.  A win32
device context (HDC) can only be destroyed from the thread that created
it.  The pbuffers for pre-render cameras are created in
osgUtil::RenderStage::runCameraSetUp, from the draw thread.  But
closeImplementation is normally invoked from the destructor in the main
application thread.  With the additional error messages I have added,
osgprerender will now output a couple of warnings from
osgViewer::PixelBufferWin32::closeImplementation() at exit, after
running multi-threaded on windows.  I think that is a good thing, to
highlight the problem.  I looked into fixing it in osgViewer::Renderer &
osgUtil::RenderStage, but it was too involved for me.  My own
application requirements are only single-threaded.

Unrelated fix - an uninitialised variable in
osg::GraphicsThread::FlushDeletedGLObjectsOperation().
"
2008-03-04 16:39:44 +00:00
Robert Osfield
ca513efc1d Added LODScaleHandler 2008-02-28 20:02:43 +00:00
Robert Osfield
a3a5af18b0 From Franz Melchior, "When switching virtual desktops or minimizing a window, keys
remain in pressed state after revealing, even if they are no
longer pressed on the keyboard. This can have bad effects,
especially if the stuck keys are modifier keys. One has to
press and release the stuck keys again to reset the wrong state.

The fix keeps track of all key presses and releases. On FocusOut
and UnmapNotify it releases all keys that are in pressed state,
and on KeymapNotify (following a FocusIn), it sets the currently
pressed keys again. To avoid confusion in the OSG-using application
normal keys are always reported released /before/ and pressed
/after/ modifier keys.

As current key states are returned as char[32] keymap by
XQueryKeymap and XKeymapEvent, this format is also used to
recognize modifier keys and for maintaining the current
internal key state. Functions to set/clear/query bits in
such a keymap are added.

The patch was extensively tested with osgkeyboard and
FlightGear under KDE and fvwm2. It was not tested on a
Xinerama setup or with multiple windows, but as _eventDisplay
is used throughout, there should be no problems. The patch also
makes the following changes:

- removes old and obsolete handling of modifier keys in ::adaptKey().
 This wasn't only unused, but also wrong (and for that reason commented
 out in revision 7066). The modifier states are actually handled
 in ./src/osgGA/EventQueue.cpp (EventQueue::keyPress/keyRelease).
- fixes some spelling"
2008-02-25 16:50:28 +00:00
Robert Osfield
fb1b58b2e2 From Stephan Huber, "I missed a refactoring of the handling of modifier-keys, so they did not
work on OS X. Attached you'll find the missing implementation for OS X."
2008-02-25 16:05:53 +00:00
Robert Osfield
3333ca2b46 From Mathias Froehlich, "I have extended the X11 pbuffer code to use either the complete set of glx 1.3
pbuffer functions or exactly ask for the extensions we need to call the
apropriate glx extension functions for and around pbuffers extensions.
The glx 1.3 version of this functios are prefered. If this is not pressent we
are looking for the glx extensions and check for them.
Prevously we just used some mix of the glx 1.3 functions or the extension
functions without making sure that this extension is present.
"
2008-02-22 18:38:30 +00:00
Robert Osfield
8e5c3363ef From Stephan Huber, "Attached you'll find some enhancements by Adrian Egli and me for the
carbon-implementation of GraphicsWindow.  Now you can use an AGLDrawable
in conjunction with osgViewer/osgCompositeViewer."

Changes from Robert Osfield, changed std::cout to osg::notify(osg::INFO)
2008-02-18 15:30:55 +00:00
Robert Osfield
54129105a4 Added projectorMatrix parameter support to *SphericalDisplay setup functions and .view, this allows one
to flip, rotate, or turn up side the position of the projector.  Note, projector at base of display is the default.
2008-01-28 15:41:42 +00:00
Robert Osfield
49696d776a From Stephan Huber, "attached you'll find an updated carbon-implementation, which implements
the missing functionality for setWindowName and useCursor
"
2007-12-17 10:24:20 +00:00
Robert Osfield
6cca3b8f49 Added a osgViewer::setSceneData(ref_ptr<Node>) method. 2007-12-12 17:59:06 +00:00
Robert Osfield
ffab16ba2f From Karl Heijdenberg, moved set/getFrameStamp() from osgViewer::View to osg::View. 2007-12-11 16:34:37 +00:00
Robert Osfield
f4afa427a7 From Roland Smeenk, "Attached you will find a large set of small typo fixes (mainly in the comments)." 2007-12-10 17:30:18 +00:00
Robert Osfield
6c09a22957 From Cedric Pinson, fixes for toggle fullscreen on gnome desktop 2007-12-06 17:28:29 +00:00
Robert Osfield
b62716d679 Added asView() method to GUIActionAdapter to help out with .NET wrappers. Updated wrappers 2007-10-04 11:20:18 +00:00
Robert Osfield
caeed02f52 Merged the threading set up and rendering code from Viewer and CompositeViewer
into ViewerBase to allow CompositeViewer to inherit the same theading models
previously just supported by osgViewer::Viewer
2007-10-02 21:23:58 +00:00
Robert Osfield
4cf73d4c87 Changed HelpHandler so it supports use with CompositeViewer and Viewer 2007-09-30 19:15:32 +00:00
Robert Osfield
91900254f0 Moved ViewerBase class out into its own header and source file.
Improved the support for stats collection in CompositeViewer/StatsHandler.
2007-09-30 11:37:00 +00:00
Robert Osfield
f8729af8b2 Refactor Viewer/CompositeViewer so the both inherit from the a ViewerBase class 2007-09-29 16:46:08 +00:00