Commit Graph

269 Commits

Author SHA1 Message Date
Robert Osfield
14a563dc9f Ran script to remove trailing spaces and tabs 2012-03-21 17:36:20 +00:00
Robert Osfield
5d50913722 From Mathias Froehlich, "Attached is a change to the stats handler so that the aspect ratio of the
viewer stats coordinates always stay about 1:1 to the pixels.
This helps for more readable stats with very wide windows for example."
2012-02-06 13:40:01 +00:00
Robert Osfield
85bce8b8ad From Stephan Huber, "attached you'll find a first version of multi-touch-support for OS X (>=
10.6), which will forward all multi-touch events from a trackpad to the
corresponding osgGA-event-structures.

The support is switched off per default, but you can enable multi-touch
support via a new flag for GraphicsWindowCocoa::WindowData or directly
via the GraphicsWindowCocoa-class.

After switching multi-touch-support on, all mouse-events from the
trackpad get ignored, otherwise you'll have multiple events for the same
pointer which is very confusing (as the trackpad reports absolute
movement, and as a mouse relative movement).

I think this is not a problem, as multi-touch-input is a completely
different beast as a mouse, so you'll have to code your own
event-handlers anyway.

While coding this stuff, I asked myself if we should refactor
GUIEventAdapter/EventQueue and assign a specific event-type for
touch-input instead of using PUSH/DRAG/RELEASE. This will make it
clearer how to use the code, but will break the mouse-emulation for the
first touch-point and with that all existing manipulators. What do you
think? I am happy to code the proposed changes.

Additionally I created a small (and ugly) example osgmultitouch which
makes use of the osgGA::MultiTouchTrackballManipulator, shows all
touch-points on a HUD and demonstrates how to get the touchpoints from
an osgGA::GUIEventAdapter.

There's even a small example video here: http://vimeo.com/31611842"
2012-02-03 14:25:08 +00:00
Robert Osfield
d350ea5395 Moved setEndBarrierOperation(..) implementation into .cpp and added support for stoppig and starting threading if required. 2012-01-24 17:30:44 +00:00
Robert Osfield
b0b98d49b8 From Paul Martz, Added ViewerBase::s/getEndBarrierOperation(..) method to allow user control of how viewers are sync'd. 2012-01-24 17:21:14 +00:00
Robert Osfield
140a04aebc From Bjorn Blissing, "Found a minor (probably a copy & paste) bug in ViewerEventHandlers.
Line 251:
int getKeyEventWindowedResolutionDown() const { return _keyEventWindowedResolutionUp; }

Should be replaced with:
int getKeyEventWindowedResolutionDown() const { return _keyEventWindowedResolutionDown; }"
2011-09-12 12:38:41 +00:00
Robert Osfield
ca51a1113b From Magnus Kessler, documentation fixes 2011-09-12 12:14:17 +00:00
Robert Osfield
c617ea0163 Fixed virtual method mismtaches between subclasses and parent classes. 2011-06-23 16:36:36 +00:00
Robert Osfield
e1f5597167 Removed executable permission. 2011-06-14 09:11:58 +00:00
Robert Osfield
cd2eaf2826 From Stephan Huber, "proposed changes allows the user to add a osgGraphicsWindowIOS as an
UIView, respecting the sizes via GraphicsContext::Traits.
This helps users, who want to integrate osg into an existing ios-app
with multiple UIViews. Additinally a view-controller gets only created
if needed, set IGNORE_ORIENTATION via the WindowData-struct.
"
2011-05-16 12:44:39 +00:00
Robert Osfield
d054427f90 Fixed Coverity reported issue.
CID 11836: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _fullscreen is not initialized in this constructor nor in any functions that it calls.
2011-05-06 12:22:49 +00:00
Robert Osfield
da1a354502 From Stephan Huber, "attached you'll find a small enhancement for GraphicsWindowCocoa to
implement the recently introduced setSyncToVBlank-method.

Additionally I added a ToggleSyncToVBlank-eventhandler to osgViewer. I
used it to test the code, perhaps you'll find it useful and include it
in the distribution."
2011-05-04 16:01:21 +00:00
Robert Osfield
d416ebc78c From Craig Bosma,"Please find attached a fix for shared contexts on OS X, with the Cocoa backend. The NSOpenGLContext* _context member of GraphicsHandleCocoa was never set on successfully creation, so even if the dynamic_cast to GraphicsHandleCocoa succeeds, we get a bogus (NULL) pointer on retrieving the actual NSOpenGLContext* (line 1013).
This should fix the problem, as well as cause GraphicsWindowCocoa to report the correct name "GraphicsWindowCarbon" -> "GraphicsWindowCocoa".
"
2011-04-26 12:05:57 +00:00
Robert Osfield
634344aef5 From Marius Heise, "here is a patch that implements Win32 HW-synced swapping using wglJoinSwapGroupNV, wglBindSwapBarrierNV and the existing traits. It was tested with multiple ATI FirePro S400 cards.
I also fixed the vsync implementation introduced with rev.11357 that was crashing with the Windows Error #170. So I removed your temporary /* */ around the vsync condition..."
2011-04-21 13:34:03 +00:00
Robert Osfield
9bfb043a16 From Tomas Hogarth, "Attached are the complete changed files GraphicsWindowIOS and GraphicsWindowIOS.mm. The change is in regard to the ability to adapt to device orientation. We did just have a bool indicating the window would adapt to all orientations. I have changed this to a bit mask allowing the user to specify individual orientations or combinations.
enum DeviceOrientation{

                    PORTRAIT_ORIENTATION = 1<<0,

                    PORTRAIT_UPSIDEDOWN_ORIENTATION  = 1<<1,

                    LANDSCAPE_LEFT_ORIENTATION  = 1<<2,

                    LANDSCAPE_RIGHT_ORIENTATION  = 1<<3,

                    ALL_ORIENTATIONS = PORTRAIT_ORIENTATION  | PORTRAIT_UPSIDEDOWN_ORIENTATION  | LANDSCAPE_LEFT_ORIENTATION  | LANDSCAPE_RIGHT_ORIENTATION

                };

                typedef unsigned int DeviceOrientationFlags;

The main motivation for this is to easily allow the user to specifiy that the device is in a horizontal orientation rather then having to rotate the view matrix. All flags have been tested individually as well as in combinations. The default is ALL_ORIENTATIONS to keep the exiting functionality for anyone who hasn't specified WindowData for their context traits.
"
2011-04-21 12:06:06 +00:00
Robert Osfield
c13b7d26b7 From Jan Peciva, "please find attached proposed fix for ON_DEMAND rendering. The biggest issue was
that the windows did not act on repaint request (WM_PAINT, EXPOSE,...)

Detailed explanation:
- I implemented requestRedraw using the push approach (not using
GraphicsWindow::_requestRedraw flag that I was considering) as there may be
multiple viewers reading the flag and fighting to reset it after the paint
request, while some viewers may not spot the request to redraw
- I made windows call GraphicsWindow::requestRedraw when they receive
appropriate message (WM_PAINT, EXPOSE, RESIZE,...)
- There were issues on Linux that windows did not want to close using x
button. Resolved by moving the test for DeleteWindow event from
swapBuffersImplementation() to GraphicsWindowX11::checkEvents(). The difficulty
was that DeleteWindow event is not coming using _eventDisplay, but through
_display.
- The last difficulty was that it is necessary to call
ViewerBase::checkWindowStatus() to set _done to true when all windows are
closed. This did not happened recently in ON_DEMAND run scheme. I put the call
to checkWindowStatus() to eventTraversal.
"
2011-04-19 12:01:38 +00:00
Robert Osfield
efec8a13a1 Removed spaces from end of lines 2011-04-19 11:46:05 +00:00
Robert Osfield
d3d0859b4c From Piotr Gwiazdowski, "So there's config setting OSG_DISABLE_MSVC_WARNINGS which should
disable pragmas that turn off specific warnings for MSVC.
Unfortunately it's presence is only checked in osg/Export header,
making other Export headers disable warnings no matter what, which is
kind of incoherent.

My fix adds #include <osg/Config> to every Export header. I've also
unified checking whether to disable warnings to current osg/Export
way:
#if defined(_MSC_VER) && defined(OSG_DISABLE_MSVC_WARNINGS).

Attachment contains all changed Export files in their original locations."
2011-03-09 14:15:04 +00:00
Robert Osfield
afecdbb46b Moved intial cut of depth partition support into osgViewer::View via two new methods:
/** Convenience method for setting up multiple slave cameras that depth partition the specified camera.*/
        bool setUpDepthPartitionForCamera(osg::Camera* cameraToPartition, DepthPartitionSettings* dps=0);

        /** Convenience method for setting up multiple slave cameras that depth partition each of the view's active cameras.*/
        bool setUpDepthPartition(DepthPartitionSettings* dsp=0);
2011-03-03 15:52:19 +00:00
Robert Osfield
ac65e37ed3 From Mourad Boufarguine, "This is a tiny fix for some typos in osg code." 2011-01-28 10:50:24 +00:00
Robert Osfield
67ae23f2cf From Alexander Sinditskiy, "reason of this changes described in http://forum.openscenegraph.org/viewtopic.php?t=7596
and another problem is:
example osgkeyboard is not work (keys not highlight) if user have 2 keyboard layout native and english and current user layout is native

I try to explain my changes

we need something that is identify key without modifier keys and layout  -> this is UnmodifedKey

I think osg must have its own UnmodifiedKeys table. Code must be run same on different platforms. This can de guaranteed by UnmodifiedKeys table.

Mikhail Izmestev helped me. He implemented VirtualKey changes in GraphicsWindowX11"
2011-01-27 16:23:48 +00:00
Robert Osfield
762f8d5360 Fixed comment 2011-01-12 17:39:35 +00:00
Robert Osfield
e4b1b6228d From Tim Moore, "This patch fixes a race condition in Renderer::ThreadSafeQueue that was causing some notifications of available SceneView objects to be missed. I saw a very noticeable performance problem (60 fps -> 8 fps) in DrawThreadPerContext mode in an osgEarth application before this patch. I had high hopes that this change might fix the much-discussed multiple GPU problem; no such luck, but I think the root cause of that is probably a similar threading issue." 2011-01-11 16:58:17 +00:00
Robert Osfield
410b4fd109 Converted FrameStamp::g/setFrameNumber from int to uint 2010-12-22 20:11:05 +00:00
Robert Osfield
017a03ffe5 Refactor of DatabasePage/IncrementalCompileOperation to use the IncrementalCompileOperator for compiling objects 2010-12-10 15:27:19 +00:00
Robert Osfield
5723050580 From Ulrich Hertlein and Stephan Huber, improves to iOS build 2010-11-30 09:26:18 +00:00
Robert Osfield
b523cb15c1 From Tomas Holgarth and Stephan Huber, "
attached you'll find the second part of the IOS-submission. It contains

* GraphicsWindowIOS, which supports external and "retina" displays,
 multisample-buffers (for IOS > 4.0) and multi-touch-events
* an ios-specific implementation of the imageio-plugin
* an iphone-viewer example
* cMake support for creating a xcode-project
* an updated ReadMe-file describing the necessary steps to get a
 working xcode-project-file from CMake

Please credit Thomas Hogarth and Stephan Huber for these changes.

This brings the ios-support in line with the git-fork on github. It
needs some more testing and some more love, the cmake-process is still a
little complicated.

You'll need a special version of the freetype lib compiled for IOS,
there's one bundled in the OpenFrameworks-distribution, which can be used."

Notes, from Robert Osfield, modified CMakeLists.txt files so that the IOS specific paths are within IF(APPLE) blocks.
2010-11-26 18:19:28 +00:00
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