Commit Graph

766 Commits

Author SHA1 Message Date
Robert Osfield
0201480582 Added closing of the _eventDisplay on failure of initializing the context properly. 2011-05-30 09:26:24 +00:00
Robert Osfield
40fd093fb1 Reverted part of revision r12294 that introduced threading related problems under X11 due to checking the _display
Display member variable assigned to the graphics thread from the main thread.
2011-05-27 16:04:18 +00:00
Robert Osfield
bf7759829e From Olaf Flebbe, fixes for OSX AGL build 2011-05-25 09:34:02 +00:00
Robert Osfield
51a9e63c55 From Olaf Flebbe, "build out-of-the box on MacOSX. The default windowing system is carbon and it needs the AGL OpenGL Windowing binding framework, which is missing. osgViewer does not link therefore. Cocoa does not use AGL.
The fix adds the AGL Framework to the Carbon link line for osgViewer"
2011-05-24 13:05:44 +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
456d351a33 Fixed Coverity reported issue.
CID 11831: Uninitialized pointer field (UNINIT_CTOR)
Non-static class member _context is not initialized in this constructor nor in any functions that it calls.
Non-static class member _dc is not initialized in this constructor nor in any functions that it calls.
Non-static class member _handle is not initialized in this constructor nor in any functions that it calls.
Non-static class member _instance is not initialized in this constructor nor in any functions that it calls.
2011-05-06 12:22:10 +00:00
Robert Osfield
37f63e033a Fixed Coverity reported issue.
CID 11835: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _startTick is not initialized in this constructor nor in any functions that it calls.
2011-05-06 12:21:11 +00:00
Robert Osfield
0e56247cd0 Fixed Coverity reported issues.
CID 11834: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _tickLastUpdated is not initialized in this constructor nor in any functions that it calls.
Non-static class member _tmpText is not initialized in this constructor nor in any functions that it calls.

CID 11833: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _tmpText is not initialized in this constructor nor in any functions that it calls.
2011-05-06 12:20:48 +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
ff99fd07f7 Added OSGVIEWER_EXPORT 2011-05-03 12:43:00 +00:00
Robert Osfield
81a0eed67f Added missing break; 2011-05-03 10:14:34 +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
8d323fcdea From Mattias Helsing, "Fixes installation of the osgViewer headers that got broken with rev
12208 and 12231.

The windowing system specific headers under
include/osgViewer/api/<system> are again installed under
include/osgViewer/api/<system>

Works in recent ubuntu with cmake-2.8.4 and msvc2010 with cmake-2.8.2"
2011-04-21 17:16:27 +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
02081af4f8 From Fred Smith, "GraphicsWindowWin32::setWindow currently creates a context with no regards to the Traits, like createWindow does.
That is, it calls ::wglCreateContext to create a context, not the member method createContextImplementation(), which takes into an account the Traits.

In my situation, this prevents a GL 3.x context from being created.
"
2011-04-21 13:01:11 +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
8ffa50a88e Added IncrementalCompileOperation::compileAllForNextFrame(uint) method and supporting
functionality that  tell the IncrementalCompileOperation to compile all pending objects during next draw traversal,
for specified number of frames.
2011-04-18 12:35:19 +00:00
Robert Osfield
f0f31e4a8c From Stephan Huber, "Attached you'll find a fixed
GraphicsWindowCocoa-implementation which should fix the reported bugs.

the osgkeyboard-example works now, but not the numbers of the keypad, as
they hilight only for KEY_KP_Left, KEY_KP_Right, KEY_KP_Up, KEY_KP_DOWN
etc and not for KEY_KP_0 - KEY_KP_9."
2011-04-04 10:16:46 +00:00
Robert Osfield
6e182e7c17 Added set up of CulLVisitor::Identifier so that the double buffered SceneView/CullVisitor
share the same Identifier.
2011-03-17 13:54:54 +00:00
Robert Osfield
76dea3d0f4 From Torben Dannhauer, warning fix for a false positive warning generated by VS about "not all control pathes return a value". 2011-03-14 09:59:32 +00:00
Robert Osfield
339fe794b0 From Mourad Boufarguine,
"There is a redundant cmake code at the end of osgViewer cmake script. The install command is issued in SETUP_LIBRARY macro."
"I spotted this when i tried a make install on the android port :) I saw some weird copy commands of osgViewer headers.
I managed to get all osg headers copied to cmake_install_prefix/include upon make install, but i can't (yet) get the libraries to be copied to cmake_install_prefix/lib (see attached files)"
2011-03-11 10:24:12 +00:00
Robert Osfield
6055e3492a From Mourad Boufarguine, "I gave osg android port a try on Windows using cygwin, and it worked like a charm (only a tiny problem with osgViewer, when cross compiling for android using cygwin, the windows path in osgViewer/CMakeLists.txt is used rather than the android one, fix attached).
"
2011-03-10 14:53:39 +00:00
Robert Osfield
3421cbbba1 Fixed error in X11 string name 2011-03-08 17:05:29 +00:00
Robert Osfield
b24353b12c From Rafa Gaitan and Jorge Izquierdo, build support for Android NDK.
"- In order to build against GLES1 we execute:
$ mkdir build_android_gles1
$ cd build_android_gles1
$ cmake .. -DOSG_BUILD_PLATFORM_ANDROID=ON -DDYNAMIC_OPENTHREADS=OFF
-DDYNAMIC_OPENSCENEGRAPH=OFF -DANDROID_NDK=<path_to_android_ndk>/
-DOSG_GLES1_AVAILABLE=ON -DOSG_GL1_AVAILABLE=OFF
-DOSG_GL2_AVAILABLE=OFF -DOSG_GL_DISPLAYLISTS_AVAILABLE=OFF -DJ=2
-DOSG_CPP_EXCEPTIONS_AVAILABLE=OFF
$ make
 If all is correct you will have and static OSG inside:
build_android_gles1/bin/ndk/local/armeabi.

- GLES2 is not tested/proved, but I think it could be possible build
it with the correct cmake flags.
- The flag -DJ=2 is used to pass to the ndk-build the number of
processors to speed up the building.
- make install is not yet supported."
2011-03-08 16:35:37 +00:00
Robert Osfield
42b709a9f4 From Rafa Gaitan, "I have added the macro SETUP_LIBRARY, similar to SETUP_PLUGIN or
SETUP_EXE, in order to have a unique entry point to build the
libraries. With this changes the android integration will be less
painful (currently is a big IF(ANDROID) for each CMakeLists.txt) and
more maintainable in the future. I hope next submissions will be for
supporting android from my colleague Jorge.
"
2011-03-08 13:51:13 +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
597f978128 Fixed typo 2011-02-14 12:14:36 +00:00
Robert Osfield
d218a8c9a7 Added support for getting the current screen refresh rate using the XrandR extension. 2011-02-04 10:27:05 +00:00
Robert Osfield
54d16c74ad From Ulrich Hertlein, "I adapted the Cocoa implementation so that it reports the unmodified key
and the modified key as requested. Can other OS X developers please test
the attached file, to make sure it works for everybody?

I fixed the problem with the caps-lock-key, too."
2011-01-28 13:54:44 +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
abea92ee91 From Mathias Froehlich, build fixes 2011-01-24 21:12:25 +00:00
Robert Osfield
f2f9bb11b0 Moved the StateSet query and texcoord settings to within the if (vertices) block to avoid
an attempt to dereferences geometry->getStateSet() when non Geometry drawable is intersected.
2011-01-18 15:00:36 +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
ea5d88e54f Added TODO notes 2010-12-12 10:00:57 +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
0754a78ddb From Ulrich Hertlein, "Attached; here's a summary of the changes:
- CMakeLists.txt
-- don't look for GL when compiling for iOS (device or simulator), look for OGLES instead
-- use architecture i386 for simulator
-- removed iphoneos-version-min for simulator

- examples/osgviewerIPhone/CMakeLists.txt
-- added build dependencies for osgdb_osg, osgdb_freetype, osgdb_imageio
-- added framework QuartzCore link dependency

- src/osgDB/CMakeLists.txt
-- don't link against Carbon on iOS (device or simulator)

- src/osgPlugins/freetype/CMakeLists.txt
-- don't link against OpenGL on iOS device or simulator

- src/osgViewer/CMakeLists.txt
-- link against OpenGLES on iOS (device or simulator)

- src/osgPlugins/imageio/CMakeLists.txt
-- compile ReaderWriterImageIO_IOS.cpp as Objective-C++

"
2010-12-02 14:20:52 +00:00
Robert Osfield
ca0a556579 Removed redudent makeCurrentImplementation() that was causing a crash in osgscreencapture. 2010-12-02 09:39:31 +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
1bd55d732d From Tim Moore, fix to stats timing 2010-11-25 13:00:24 +00:00
Robert Osfield
043ae090a5 From Tim Moore, Fix for drivers that don't properly support timer extensions.
""
2010-11-24 10:38:28 +00:00
Robert Osfield
e1ee96b3f2 Fixed crash on intialization of static applications by moving the static mutexes inside singleton methods. 2010-11-12 09:48:21 +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
5868022ca1 Added traversal of salve camera subgraphs when the slave camera doesn't share it's scene graph wiht the View's master scene graph. 2010-11-09 17:17:13 +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
bdf1912fda From Jean-Sebastien Guay, "For a while now I've been bugged (pun) by a problem in the stats graph I submitted a long time ago. When it scrolled, sometimes it would scroll too little, leading to an empty space at the left that would grow as time went by. I was in that code today for something else so I fixed it.
"
2010-11-03 09:51:12 +00:00
Robert Osfield
7672cc57c2 Added X11_X11_LIB to LIB_EXTRA_LIBS when build X11 version of osgViewer to enable use of Mesa's GLES/EGL implementation 2010-10-29 08:33:10 +00:00
Robert Osfield
9978516bf7 Added number of primitive sets to on screen stats 2010-10-25 13:42:01 +00:00
Robert Osfield
1a292ad8e3 Integrated IncementalCompileOperation into DatabasePager.
Improved various facilities in IncrementalCompileOperation.
2010-10-21 16:29:23 +00:00
Robert Osfield
6ed74470b2 Introduction of IncrementalCompileOperation support to DatabasePager. 2010-10-14 18:16:03 +00:00
Robert Osfield
f81a9eff50 From Wojciech Lewandowski, "As promised I prepared a patch to expose WGL_SWAP_METHOD / PFD_SWAP_METHOD selection via GraphicsContext::Traits. Since Traits don't define any enums (I guess to be simple to use) I tried to keep it that way and have added two boolean values: swapCopy & swapExchange. It is somewhat similar approach to GDI PixelFormatDescription were both options can be present together. Feel free to replace it with enum if you find it more appropriate.
I also uderstand that there is a need to select system wide default  method and have also modified DisplaySettings to contain swapMethod parameter. Swap method in Traits uses value set in DisplaySettings as default. Proper environment and command line args were added.  Its possible to define default DeisplaySettings swap method in standard way via system flags or with comand line.

Env Vars:
    OSG_SWAP_METHOD  = DEFAULT | COPY | EXCHANGE
or Command Line:
    --swap-method   DEFAULT | COPY | EXCHANGE

I also added handling of WM_ERASEBKGND in GraphicsWindowWin32. It may be unneccessary but code should be safer this way than without handling it.  I have placed a comment explaining the reason above the change.

Changes were made against today trunk.

PS. I tested only Windows code. I briefly checked X11 & Cocoa files but have not noticed SwapMethod to be used there.
"
2010-10-01 18:02:24 +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
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
cbc43841e1 From Roland Smeenk, "this submission adds a "Fast Drawable" line to the camera scene statistics.
It shows the total number of sorted and unsorted drawables that use the fastpath for rendering."
2010-09-09 10:03:58 +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
3daa56f2b9 From Stephan Huber, "attached you'll find a small enhancement for GraphicsWindowCocoa, so
osgViewer behaves smarter, when the computer will reboot or shutdown. In
older versions the reboot/shutdown got cancelled by GraphicsWindowCocoa,
now it behaves more system conform.
"
2010-08-08 15:45:25 +00:00
Robert Osfield
d45cb5f7a1 From Pierre Bourdin, "just a small typo in debug messages of Viewer.cpp..." 2010-07-10 10:07:59 +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
6b2ad196c1 From Laurens Voerman, "While reading the code for setUpViewFor3DSphericalDisplay I noticed that the top face of the cube map uses Draw/Read buffer GL_BACK, while all other faces are using the GL_FRONT buffer. This because the buffer variable is hidden by a new buffer at lower scope.
Removing the local variable tested (win32 and linux64) and works fine."
2010-06-18 15:48:50 +00:00
Robert Osfield
b8d4533fa3 Added checks against windows being realized before doing warp pointer 2010-06-18 14:53:58 +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
205edcf297 From Jean-Sebastien Guay, "Currently, if a GraphicsWindowWin32 is created with traits->useCursor = false, it still shows the cursor. An app must call gw->useCursor(false) after having created the context as a workaround, but I think what we ask for in the traits should be honored... Attached is a simple fix for this.
I have no idea when this stopped working. It worked before in our 2.6.0-based apps but after the upgrade to 2.8.3 it doesn't anymore.
"
2010-06-14 15:28:58 +00:00
Robert Osfield
634e55eee3 Fixed permissions 2010-06-03 16:02:01 +00:00
Robert Osfield
ddf5668809 conversion of osg::notify to OSG_INFO etc. 2010-05-28 15:56:43 +00:00
Robert Osfield
e753be1b20 Changed debug info to use DEBUG_INFO 2010-05-28 09:12:07 +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
29ea65c12b From Gunter Huber, fixes for better GLES2 support 2010-05-13 10:01:07 +00:00
Robert Osfield
b1179978f5 From Stephan Huber, "attached you'll find a fix for a crash when closeImplementation gets
called more than once."
2010-05-12 11:41:36 +00:00
Robert Osfield
c2a59415ce Changed DisplaySetting::instance() to return a ref_ptr<>& rathern than a raw C pointer to enable apps to delete the singleton or assign their own. 2010-04-30 11:48:30 +00:00
Robert Osfield
afce262601 Added free of _visualInfo if it's already been allocated 2010-04-30 10:52:24 +00:00
Robert Osfield
a6c7fee246 From Alok Priyadarshi, "1. Replaced APIENTRY to GL_APIENTRY which is used by OpenGL ES
headers. For desktop GL GL_APIENTRY has been defined as APIENTRY."
2010-04-28 21:22:44 +00:00
Robert Osfield
60b906b9fe Added a temporary /* */ around the check against _traits->vsync to avoid the errors reported with the current usage of RestoreContext for setting the vsync. 2010-04-22 08:59:52 +00:00
Robert Osfield
be0e573f80 From Torben Dannhauer, fixed typo 2010-04-22 07:32:11 +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
6e03d73efe Changed "Sorted" label to "Sorted Drawables" 2010-04-21 16:44:38 +00:00
Robert Osfield
eef7da35d1 Fixed the background quad size to fit all the camera stats labels 2010-04-20 11:05:22 +00:00
Robert Osfield
7c38643a77 From Tim Moore, "I noticed that the "Materials" statistic in the camera scene stats display seemed to be identical to the number of drawables. In fact, it displays the nummat member of osgUtil::Statistics, but that variable has nothing to do with materials. nummat tracks the number of matrices associated with Drawable objects in a RenderBin; as I understand it, Drawables pretty much always have a model-view matrix tied to them in RenderBins, so this statistic doesn't seem very useful. So, I added statistics for the number of StateGraph objects in RenderBins and also for the number of Drawables in the "fine grain ordering" of RenderBins. The latter corresponds to the number of Drawables in the scene that are sorted by some criteria other than graphics state; usually that is distance for semi-transparent objects, though it could be traversal order. These two statistics give an idea of the number of graphic state changes happening in a visible scene: each StateGraph implies a state change, and there could be a change for each sorted object too. You can also subtract the number of sorted Drawables from the total number of Drawables and get an idea of how many Drawables are being drawn for each StateGraph.
"
2010-04-20 10:59:44 +00:00
Robert Osfield
c091b5c2d1 From Stephan Huber and Mathieu Marache, "attached you'll find framework support for os x via cmake. Please credit
Mathieu Marache, he added the last missing piece to this puzzle.

I think it is safe to commit these changes to trunk, as the traditional
way via dylibs should work as before.

Here's some more info how to get frameworks:

With these modifications it is possible to compile frameworks on OS X,
when you set the Cmake-option OSG_COMPILE_FRAMEWORKS to true. If you
want to embed the frameworks in your app-bundle make sure to set
OSG_COMPILE_FRAMEWORKS_INSTALL_NAME_DIR accordingly.

You'll have to build the install-target of the generated xcode-projects
as this sets the install_name_dirs of the frameworks and plugins."
2010-04-19 13:44:42 +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
9045d03a0b Removed the setting of the DatabasePager thread affinity, and moved the setting of the DatabasePager thread priotity to after the creation of the threads 2010-04-15 11:02:22 +00:00
Robert Osfield
b6a5754127 Added minimum frame delay of 1/100th second when using
on demand rendering to avoid creating a CPU lock.
2010-04-14 13:39:43 +00:00
Robert Osfield
8547536387 From Jean-Sebastien Guay, "When the StatsHandler tries to find a context to add itself to, it will first look for a GraphicsWindow, and if none is found it will look for a GraphicsContext. This enables apps that do all their rendering to offscreen contexts (pbuffer) to still use the StatsHandler." 2010-03-26 11:09:10 +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
d969034f44 Changed private: to protected: to fix build issue under OSX 2010-03-22 14:32:19 +00:00
Robert Osfield
994e7ece43 From Ulrich Hertlein, changed init() call to _init(). 2010-03-20 09:45:59 +00:00
Robert Osfield
1b6adccdc4 From Wang Rui,
"Here is a small fix in the eventTraversal() function of both viewer
and composite viewer class.

if (getCameraWithFocus())
{
   if (getCameraWithFocus()!=getCamera())  // Newly added
   {
       osg::Viewport* viewport = getCameraWithFocus()->getViewport();
       osg::Matrix localCameraVPW =
getCameraWithFocus()->getViewMatrix() *
getCameraWithFocus()->getProjectionMatrix();
       if (viewport) localCameraVPW *= viewport->computeWindowMatrix();

       osg::Matrix matrix( osg::Matrix::inverse(localCameraVPW) *
masterCameraVPW );

       osg::Vec3d new_coord = osg::Vec3d(x,y,0.0) * matrix;

       x = new_coord.x();
       y = new_coord.y();
   }
   ...
}

I put an additional conditional statement here to ensure that
_cameraWithCamera and _camera are different, otherwise it's no need to
calculate the transition matrix from main camera to focus camera. The
excess calculations of 'matrix' and 'new_coord' may cause
floating-point error and return a slightly wrong result other than an
identity matrix. It seems OK in most cases but will be still pain when
there is little difference between two mouse moving events. "
2010-03-15 14:47:22 +00:00
Robert Osfield
f27c103ec7 Refactored the initialization of OSX windowing settings so that it's done on demand rather than on startup. 2010-03-13 11:28:00 +00:00
Robert Osfield
44f8848c9f Removed now redundent call to register PagedLODs 2010-03-04 12:14:39 +00:00
Robert Osfield
7ca071192e From Erik Johnson, "There is an issue on win32 if the application hides the cursor using GraphicsWindowWin32::useCursor(false). The cursor has a habit of re-showing itself.
To reproduce, on win32:

-Run osgViewer in a windowed mode, with the cursor off, as such:
    osgViewer::Viewer::Windows windows;
    viewer.getWindows(windows);
    for(osgViewer::Viewer::Windows::iterator itr = windows.begin();
       itr != windows.end();
       ++itr)
    {
       (*itr)->useCursor( false );
    }

-Quickly move the cursor into the window  (cursor it should be hidden)
-Resize the window by dragging the border (notice the cursor changes to "resize" cursor)
-Move the cursor back to the inside of the window (notice the cursor is not hidden anymore)

The attached SVN patch will set the cursor to a "NoCursor" during useCursor(false).  This correctly stores the no cursor state, so it can be rejuvenated after a future cursor change.  This patch also fixes a couple instances where a hidden cursor should show itself, like when it's on the title bar, or the window close button."
2010-02-25 18:05:59 +00:00
Robert Osfield
7f454bef3e Converted View across to use ObserverNodePath. 2010-02-20 17:36:55 +00:00
Robert Osfield
4e44073e6b Changed NOTIFY to OSG_NOTIFY 2010-02-10 15:18:20 +00:00
Robert Osfield
f17e401347 Convert NOTIFY to OSG_NOTIFY to avoid problems with polution of users apps with the NOTIFY macro 2010-02-10 12:44:59 +00:00
Robert Osfield
8d8037ee12 Converted osg::notify usage to NOTIFY 2010-02-09 18:24:37 +00:00
Robert Osfield
306f45fbf2 From Laurens Voerman, "Wile working with pbuffers I noticed that the Win32 implementation uses the attribute WGL_PBUFFER_LARGEST_ARB.
> quote from http://www.opengl.org/registry/specs/ARB/wgl_pbuffer.txt
>    The following attributes are supported by wglCreatePbufferARB:
>
>      WGL_PBUFFER_LARGEST_ARB     If this attribute is set to a
>                                  non-zero value, the largest
>                                  available pbuffer is allocated
>                                  when the allocation of the pbuffer
>                                  would otherwise fail due to
>                                  insufficient resources.  The width
>                                  or height of the allocated pbuffer
>                                  never exceeds <iWidth> and <iHeight>,
>                                  respectively.  Use wglQueryPbufferARB
>                                  to retrieve the dimensions of the
>                                  allocated pbuffer.

It notifies the user when the size is not as requested, but I could find no way for the program to detect this. I've added two lines to write the new size back into the _traits, I think this is appropriate, but I am not absolutely sure.

In PixelBufferX11 was no support, so I've added GLX_LARGEST_PBUFFER(_SGIX) support, with the same writeback to the _trais.


I have tested the GLX_LARGEST_PBUFFER version on linux and the WGL_PBUFFER_LARGEST_ARB with windows, all tested with the modified autocapture I just submitted.


"autocapture --pbuffer --window 100 100 18192 18192 cow.osg.\[0,0,-22.7\].trans"
gives me a 4096x4096 image on my windows machine,
and a 8192x8192 image on linux."
2010-01-26 17:04:55 +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
f795770fed Added support for passing on slave Camera's StateSet's to the rendering backend. 2010-01-21 10:24:48 +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
49d6a96a5a From Lilin Xiong, "when using stlport5.3 (vc 2003) , this line cann't be compiled:
_instances[0] = new WGLExtensions;
    change to:
   _instances[HGLRC(0)] = new WGLExtensions;"
2009-11-24 14:22:12 +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
255f6dda41 Moved the ImagePager update to before the main scene graph update traversal 2009-11-20 14:40:58 +00:00
Robert Osfield
d9c1f45231 From Wang Rui, "I've made a small fix to osgViewer/Scene.cpp, which is already attached. I would like to explain what I've done and why.
In Scene::updateSceneGraph(), change:

if (getSceneData())
{
        updateVisitor.setImageRequestHandler(getImagePager());
        getSceneData()->accept(updateVisitor);
}
if (getDatabasePager())
{
        // synchronize changes required by the DatabasePager thread to the scene graph
        getDatabasePager()->updateSceneGraph((*updateVisitor.getFrameStamp()));
}

to

if (getDatabasePager())
{
        // synchronize changes required by the DatabasePager thread to the scene graph
        getDatabasePager()->updateSceneGraph((*updateVisitor.getFrameStamp()));
}
if (getSceneData())
{
        updateVisitor.setImageRequestHandler(getImagePager());
        getSceneData()->accept(updateVisitor);
}

That is, just swap the positions of two 'if () {...}' segments.

While working on a paged terrain, I need to collect every newly allocated PagedLODs and make them temporarily unrenderable in the next frame, which are all done in a update callback. But I found that these PagedLODs will always be shown before collecting them, because of the unsuitable sequence in Scene::updateSceneGraph(). DatabasePager is synchronized AFTER the user updating traversal, that is, user cannot IMMEDIATELY find out changes made by DatabasePager.
 "
2009-11-20 14:39:15 +00:00
Robert Osfield
57319d72af From Stewart Andreason, "When I open the Window Attributes (in WindowManager in X on linux) I am unable to save any changes to the attributes in the resource database, because the osg window does not have a class defined. The Window Specification and Save buttons are greyed out.
For example, when running FlightGear, I want the window to always have no title, so it opens full-screen without using the --full-screen option, which would prevent other windows from moving above the osg window.

I am attaching a patch I made to fix this problem."
2009-11-20 11:25:49 +00:00
Robert Osfield
0891e011dc From Vincent Gadoury, "In osgViewer::Viewer and osgViewer::CompositveViewer, the DOUBLECLICK event type was not considered as a "pointer event" and thus was receiving the event state coordinates and button mask. As a result, a double-click event always had a button mask not including the double-clicked button, even if double-click event is a "button push" event.
The modification consists only in including osgGA::GUIEventAdapter::DOUBLECLICK in the list of "pointerEvent" events.

Test done to reproduce the problem and check the fix: in any osg application or example with an HandleInput function, break on events with a double-click event type. Without the changes, the event's buttonMask does not contain the double-clicked button. With the changes, it does.

Only simple tests (running some examples and playing with the mouse) were done to check that the changes do not break anything, since double-click is not used thoroughly in OSG.

Modification done against current SVN Trunk version (r10753).

As this is a fix, I do not wish to keep my copyright on this submission and assign it over to the project lead.
"
2009-11-19 17:22:20 +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
370deba546 <iterator>, <stdlib.h> and <ctype.h> includes required for QNX compiler 2009-11-17 14:06:07 +00:00
Robert Osfield
b3feedaf0a Added dummy StateSet at top of scene graph when using ShaderGen to copy with subgrahs that contain no StateSet 2009-11-13 12:51:42 +00:00
Robert Osfield
6649f51ff2 From Paul Martz, osgViewer Win32 GL3 context creation support 2009-11-13 10:03:02 +00:00
Robert Osfield
95d54ba15c Added glContexVersion, glContextFlags and glContextProfileMask members to osg::GraphicsContext::Traits to support GL3 graphics context creation.
Moved the handling of DisplaySettings into Traits constructor.

Added support for s/getGLContextVersion(), s/getGLContextFlags() and s/getGLContextProfileMask() to osg::DisplaySettings.

Added command line and env var support for setting the GLContextVersion, GLContextFlags and GLContextProfileMask to osg::DisplaySettings.
2009-11-11 15:25:42 +00:00
Robert Osfield
d3ab362eae Removed debug message 2009-11-10 14:59:42 +00:00
Robert Osfield
def04324a4 Added the default usage of ShaderGenVisitor to help with GLES2 testing. 2009-11-10 11:34:57 +00:00
Robert Osfield
5b236c685b Added state.checkGLErrors() calls to help in debugging of GLES 2 port 2009-11-10 11:34:31 +00:00
Robert Osfield
959cd04097 Cleaned up the EGL context config set up. 2009-11-06 10:38:22 +00:00
Robert Osfield
0c8661be5f Added EGL error checking and changed the egl context configuration settings 2009-11-06 10:31:03 +00:00
Robert Osfield
72ff1f40f9 From Paul Martz, changes for compiling against OpenGL 3.x 2009-11-03 16:34:54 +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
519c70ea5f Fixed compile problem due to name change of getGLXContext to getContext 2009-10-31 14:44:43 +00:00
Robert Osfield
68556419cc Fixed build under GLES2 2009-10-30 17:16:50 +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
d17d7159a1 Ported osgUtil, osgDB, osgGA, NodeKits and plugins to compile against OpenGL ES 1.1 and OpenGL ES 2.0. 2009-10-28 20:31:57 +00:00
Robert Osfield
972e68113d From Mathias Froehlich, "This change eliminate an orphan stats block that sticks somewhere in the
screen stats display."
2009-10-10 10:58:39 +00:00
Robert Osfield
01b5bf97f4 From Bob Kuehne, "fix for 10.6/darwin: this fix changes what i believe to be a typo in the os x darwinutils file from ID to id, the proper objective-c name for a type." 2009-10-10 09:20:39 +00:00
Robert Osfield
32b21dbb89 Introduced new GLBufferObject pool for managing the memory footprint taken up by VertexBufferObejct, ElementBufferObject and PixelBufferObject. 2009-10-03 09:25:23 +00:00
Robert Osfield
f75013d534 Introduced new BufferObject design + implementation in preperation of implementing a pool system for buffer objects 2009-10-01 20:19:42 +00:00
Robert Osfield
3d75054e2c Preliminary work on support for a texture object pool that is designed to help manage resources down the GPU more tightly. 2009-09-22 18:45:24 +00:00
Robert Osfield
564ae70d45 From Tom Moore, "Parens were being returned when the bracket keys were typed. The fix
is easy and the original code looks like a typo"
2009-08-20 16:05:06 +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
bedd22de23 From Cory Riddel based on suggestion from Robert Osfield, "I've been running with your suggested changes for a few days now and it
has been working perfectly. I'm still not entirely clear why adding a
slave/subgraph causes the problem."
2009-07-13 16:39:51 +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
3a65636893 From Stephan Huber, fixes to Cocoa support 2009-06-25 16:12:58 +00:00
Robert Osfield
06abd75198 From Mathias Froehlich, "We are currently getting issues with locale settings and some osg plugins.
Therefore I have changed all the occurances of atof by asciiToFloat or
asciiToDouble.

I believe that it is safe to do so at least for all the plugins.
Included here are also asciiToFloat conversion of environment variables. One
might argue that these should be locale dependent. But IMO these should be
set and interpreted by osg independent of the current locale.
"
2009-06-25 16:07:49 +00:00
Robert Osfield
93a0391dc3 Added clears to various vectors being passed in to get*() methods. 2009-06-19 11:00:33 +00:00
Robert Osfield
677256c724 From Cory Riddell, "I added a line to clear the threads vector prior to populating it in
Viewer::getAllThreads(). This is consistent with what happens in
Viewer::getOperationThreads()."
2009-06-19 10:55:12 +00:00
Robert Osfield
a921031034 From Stephan Huber, "here are some small fixes/enahncements for the cocoa backend to allow
proper functioning when running the osgViewer run-loop in a secondary
thread (e.g. when embedding GraphicsWindowCocoa-windows in a full blown
cocoa application).

OS X is picky when you want to change the user-interface from another
thread than the main thread, not all UI stuff is thread-safe. So now
window closes and showing / hiding the menu bar is done in the main
thread via Cocoa's performSelectorOnMainThread-mechanism.

These changes don't affect the normal osgViewer usage pattern."
2009-06-12 10:00:08 +00:00
Robert Osfield
3171be0ff7 From Gustav Haapalahti and Robert Osfield,
First Submission email from Gustav:
"This submission adds a --cache option to osgconv and osgviewer that enables setObjectCacheHint(osgDB::Options::CACHE_ALL); It greatly reduces memory usage when a .osg file has lots of external references with ProxyNode:s that points to the same file.

Options are also added to the osg plugin. The code was already mostly implemented but there was no way to change the options.
includeExternalReferences
writeExternalReferenceFiles
A counter is added to keep track if an external file has already been written down to avoid writing the same file over and over again. If it has already been written once then it is not written again.
The counter is added to the Output class in osgDB.
"

Second Submission email from Gustav:
"This is a continuation to my previous submission.
I noticed that the same problem that I fixed in ProxyNode.cpp for the osg plugin (external files being written over and over again) also existed in the ive plugin. I attached a submission where the ive plugin remembers which external files that have already been written and do not write them again."


Changes to the above done by Robert Osfield,

    changed command line parameter to --enable-object-cache
    changed set/get methods in osgDB::Output and ive/DataOutputStream.cpp to be s/getExternalFileWritten(const std::string&)
    cleaned up set up of osgDB::Options.
2009-06-08 16:50:50 +00:00
Robert Osfield
aa69137fb8 Added collateReferencesToDependentCameras() and clearReferencesToDependentCameras() methods into RenderStage and SceneView, and use
of these methods in src/osgViewer/Renderer.cpp to make sure that the draw thread keeps references to all in scene graph Cameras
that are being used by the drawing threads, to keep the Camera's alive even when the main thread removes these Cameras from the scene graph.
2009-06-05 19:05:37 +00:00
Robert Osfield
55ae7c05bc Refactored the adaption of X11 key symbols into OSG key events to fix problems with handling wide range of locales. 2009-06-02 08:56:32 +00:00
Robert Osfield
4f0d658ce9 From Mathias Froehlich, "This frees some memory that is allocated by the X11 functions." 2009-05-28 14:15:36 +00:00
Robert Osfield
f80033d892 From Stephan Huber, "attached you'll find a small fix for GrphicsWindowCocoa. There was a bug
with certain key-strokes, which led to a crash."
2009-05-28 14:09:16 +00:00
Robert Osfield
1f9ef36545 Refactored the GraphicsWindowX11::adaptKey() implementation so that it always uses the reampX11Key(ks) method, and for the mapping to handle case correctly. 2009-05-25 16:34:26 +00:00
Robert Osfield
d85a2e2836 From Stephan Huber, "when using windownames and switching between fullscreen and windowed
mode GraphicsWindowCocoa crashes. Attached you'll find a fix for that bug.
"
2009-05-19 10:45:57 +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
0442237ec1 Changed 0 initializer to InheritCursor 2009-05-08 12:38:05 +00:00
Robert Osfield
fafb7028f8 Fixed unitialized variable 2009-05-08 07:50:09 +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
255243ea0c From Chris Denham, "For me, on Windows, I also get a slew of these warnings when I move the window off screen.
So, might be a bit fiddly to try and prevent frame update in all situations that SwapBuffers retuns false.
I wondered if we could address this issue by only reporting the error if GetLastError is also non zero. Works for me!
The value returned by GetLastError is zero when SwapBuffers is called for a minimized or off screen window, so we could just add a check for this.
Just say the word, and I'll post my modified GraphicsWindowWin32.cpp to the submissions list. ;-)
Cheers.
Chris.

e.g.

//------------- OSG- 2..8 ----------
void GraphicsWindowWin32::swapBuffersImplementation()
{
   if (!_realized) return;
   if (!::SwapBuffers(_hdc))
  {
      reportErrorForScreen("GraphicsWindowWin32::swapBuffersImplementation() - Unable to swap display buffers", _traits->screenNum, ::GetLastError());
  }
}
//------------- Modification to remove redundant warnings ----------
void GraphicsWindowWin32::swapBuffersImplementation()
{
   if (!_realized) return;
   if (!::SwapBuffers(_hdc) && ::GetLastError() != 0)
  {
      reportErrorForScreen("GraphicsWindowWin32::swapBuffersImplementation() - Unable to swap display buffers", _traits->screenNum, ::GetLastError());
  }
}
"
2009-05-07 13:15:19 +00:00
Robert Osfield
e938b6352b Added check against the validity of ViewerBase to make sure that a null pointer isn't dereferenced. 2009-04-30 13:13:19 +00:00
Robert Osfield
04238d128d Fixed warning 2009-04-25 21:44:38 +00:00
Robert Osfield
2d621cb58a Added checking of need to update. 2009-04-24 18:37:36 +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
70771cf6ce Added hand cursor implementation 2009-04-22 11:22:08 +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
7bfca5e760 From Stephan Huber, "attached you'll find a small fix for PixelBufferCarbon preventing it to
be compiled for 64bit. This is the easiest solution for the old
deprecated xcode project."
2009-04-09 15:34:06 +00:00
Robert Osfield
3a5509b2f9 Converted tabs to four spaces 2009-04-09 15:33:28 +00:00
Robert Osfield
caee4f4d1b From Eric Sokolowsky, "
The osgViewer::CompositeViewer had partial support for Producer Camera
config files, but it was not working completely. Here is the completed
implementation. File: src/osgViewer/CompositeViewer.cpp.
"
2009-04-08 14:16:09 +00:00
Robert Osfield
b233174133 From Eric Sokolowsky,"libosgViewerd.so was not being built properly because it was being
linked with system libraries using LINK_INTERNAL instead of
LINK_EXTERNAL. This caused it to try to link with libXrandrd instead of
libXrandr, which failed. Attached is the fixed CMakeLists.txt."
2009-04-08 13:40:40 +00:00
Robert Osfield
69181e1697 From Eric Sokolowky, ""Running" was spelled "Ruinning", which is hardly the same." 2009-04-08 13:16:44 +00:00
Robert Osfield
39cecd2a72 From Philip Lowman, "Here's the promised cleanup of the OSG's CMakeLists.txt files for the src/ folder. I'll submit the others separately.
Also, there was also a small bug in osgDB's CMakeLists.txt that was causing an error when I tested with CMake 2.4.4.

IF(${OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX} STREQUAL "quicktime")
was changed to
IF(OSG_DEFAULT_IMAGE_PLUGIN_FOR_OSX STREQUAL "quicktime")
"
2009-03-23 16:01:02 +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
c3810e130b Converted tabs to four spaces 2009-03-11 10:34:29 +00:00
Robert Osfield
357d465d49 From Stephan Huber, "refactored the code and moved
some stuff out into DarwinUtils.h/.mm so both implementations can share
some of the code. There's even a bugfix for GraphicsWindowCarbon, which
fixes some issues with multiple windows on different screens."
2009-03-11 10:34:04 +00:00
Robert Osfield
5157f06bcd From Konstantin Matveyev, submitted by Valery Bickov:
"There is error in WoW shader, you can see it by this simple example:
osgviewer cessna.osg --wowvx-42 --clear-color 0,0,0

Clear color may be choosed any with at least one component equals to 0
or 1. In my case I see weird blinking between normal image and image
with depth map at right side on the screen."
2009-03-10 17:47:54 +00:00
Robert Osfield
0669107287 From Roland Smeenk, "While working on the Collada plugin I noticed that all geometry created by the dae reader result in slow path geometry.
Because there already exists the option to convert slow path geometry to the fast path by computing an internal fast path alternative, I added a new optimizer option that automatically does this. To check the results I also made some changes to the statistics gathering and rendering.

Somewhat unrelated, but also part of the optimizer I disabled removal of CameraView nodes during RemoveRedundantNodes optimization.
As discussed on the ML, CameraViews were removed from the scenegraph. This solves that issue.

Summary:
-Geometry::areFastPathsUsed now also looks at internalOptimizedGeometry
-Added Optimize option to make all slow path geometry compute their internal fast path alternative
-Added fast geometry counter to the statistics
-Disabled removel of CameraViews in optimizer
"
2009-03-10 14:15:59 +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
eef4801ba7 From Roland Smeenk, "Attached is a small bug fix for the redundant messages that are created in OSG applications on windows. GraphicsWindowWin32::setCursor is called every frame from the WM_NCHITTEST message. This will result in a call to ::SetCursor(_currentCursor) every frame, which again causes a WM_MOUSEMOVE to occur. The fix exits GraphicsWindowWin32::setCursor if the requested cursor already is the current cursor.
"
2009-02-27 11:11:06 +00:00
Robert Osfield
abe28296ee From Ralf Habacker, fix to memory leak in GraphicsWindowWin32.cpp. Merged from OSG-2.8 branch using svn command:
svn merge -r 9726:9727 http://www.openscenegraph.org/svn/osg/OpenSceneGraph/branches/OpenSceneGraph-2.8
2009-02-09 21:42:45 +00:00
Robert Osfield
f3166c2d96 From Sherman Wilcox, added VS versioning information into libs 2009-02-05 14:55:17 +00:00
Robert Osfield
1153ea5feb Warnings fixes for VS. 2009-02-02 20:35:19 +00:00
Robert Osfield
965b7ddc72 Attempt to appease both FreeBSD CMAke 2.6.2 + Linux CMake 2.4.8 builds 2009-02-02 20:34:58 +00:00
Robert Osfield
e1bdee5338 Improved handling of stats projection size 2009-02-02 17:15:40 +00:00
Robert Osfield
2d55740b3e Refactored osg::TransferFunction1D to use an std::map internally which is kept in sync with the actual osg::Image that is passed to the GPU.
Added .osg support for osg::TransferFunction1D.

Updated wrappers
2009-02-02 14:43:27 +00:00
Robert Osfield
6fda032aa2 Rejigged the Xrandr include 2009-01-31 10:21:36 +00:00
Robert Osfield
7a7c64211c Fixed size of background of frame stats so that it's the correct width of the window 2009-01-30 12:09:06 +00:00
Robert Osfield
66d77e3ebd Fixed the sumation of the the unique number of primtivesets and vertices in the scene Stats collect 2009-01-29 14:41:18 +00:00
Robert Osfield
ef9987559e From Paul Melis, "1) Changes the order of the camera stats slightly, to be more in line with
the view stats
2) Uses a slightly smaller block for view statistics"
2009-01-28 13:45:04 +00:00
Robert Osfield
789c35381d Added check against existing of a valid Stats object in ViewerBase::renderinTraverls() to prevent crash.
Added default View Stats into src/osgViewer/View.cpp to enable stats to be collected for views
2009-01-28 10:06:15 +00:00
Robert Osfield
2b45fd1510 From Paul Melis, "Here is an updated osgViewer::StatsHandler. It has the following changes:
- The text and dark background rectangles are now correctly placed, and
slightly resized here and there.
- All counters (vertices, etc) now use a fixed formatting with 0 digits
precision, to prevent the text from being shown in scientific notation
when the number get large (e.g. 6.34344e+6). I tested with a scene
containing roughly 4 million vertices, to make sure its stats would
display correctly.

I also made slight changes to osgcompositeviewer (attached) to aid in
testing the stats display, specifically displaying of camera and view
names."
2009-01-28 09:31:43 +00:00
Robert Osfield
49fbc56587 From Paul Melis, removed redundent spacing. 2009-01-28 09:24:06 +00:00
Robert Osfield
29157f24d9 Refactored the view stats. 2009-01-27 13:23:20 +00:00
Robert Osfield
48f683ec3f Ported onscreen camera stats across to using thread safe stats collection 2009-01-26 21:23:09 +00:00
Robert Osfield
55a0381687 Moved the XRANDR include into LIB_PRIVATE_HEADERS to avoid FreeBSD build problem 2009-01-26 13:48:50 +00:00
Robert Osfield
1def3b3512 Fixed warnings reported on CDash 2009-01-09 15:09:39 +00:00
Robert Osfield
fa499dc55f From Andy Skinner, fixes for Solaris build 2009-01-09 12:17:40 +00:00
Robert Osfield
b1559ce696 Added handling of when a View isn't yet assigned to a Viewer to avoid associated crash 2009-01-07 14:49:04 +00:00
Robert Osfield
418dc34776 Fixed warnings 2009-01-07 11:24:47 +00:00
Robert Osfield
05cb054140 Added OPTIONAL into INCLUDE(FindPkgConfig) 2008-12-20 12:52:16 +00:00
Robert Osfield
ad01f19db8 Removed debug message 2008-12-19 18:02:18 +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
288e1853b9 Fixed warnings 2008-12-17 17:11:13 +00:00
Robert Osfield
8a6e04b84d Introduce NodeVisitor::className and libraryName() 2008-12-17 12:13:15 +00:00
Robert Osfield
3313327ab4 From Bob Kuehne, build fixes. 2008-12-16 19:49:09 +00:00
Robert Osfield
4511281f04 From Sukender and Robert Osfield, introduced GraphicsContext::ScreenSettings & WindowingSystemInterface::enumerateScreenSettings. 2008-12-16 15:08:04 +00:00
Robert Osfield
8e49efd496 From Tatsuhiro Nishioka, "I found a bug in GraphicsWindowCarbon.
GraphicsWindowCarbon::requestWarpPointer() places the mouse pointer in a (global?) display coordination, but it must be in a local window coordination. This problem is critical because the mouse cursor can go off a window especially when you place the window on the secondary screen.

Attached is the file to fix this problem.

I tested this modified file with the following situations (on FlightGear) and all works fine.
- two windows on two screens (each has one window).
- two windows on two screens (secondary screen has all windows).
- two windows on two screens (primary screen has all windows).

In all scenarios, warp requests (by right-click the mouse) successfully moves the mouse pointer to the center of the main window,
and it is what it's supposed to be in the flightgear."
2008-12-15 20:38:40 +00:00