Commit Graph

2125 Commits

Author SHA1 Message Date
Robert Osfield
43f8a13d03 Fixed ignored qualifiers warning 2016-06-08 11:06:52 +01:00
Robert Osfield
20148c5b8d Fixed unused parameter warning. 2016-06-08 11:05:29 +01:00
Robert Osfield
2052b2741e Fixed unused parameter warning. 2016-06-08 11:04:24 +01:00
Robert Osfield
b1b7d17633 Fixed build issues when OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION is set to OFF 2016-06-02 12:22:51 +01:00
Alberto Luaces
68baf15806 defines for building on Hurd and BSD kernels 2016-05-31 12:58:57 +01:00
Alberto Luaces
260cbab518 Typo fixes 2016-05-30 12:30:05 +01:00
Robert Osfield
7d816362e6 Fixed shadows warning 2016-05-26 15:07:02 +01:00
Robert Osfield
dbce12842e Fixed shadows warnings 2016-05-26 11:13:56 +01:00
Robert Osfield
80e318ce15 Fixed shadows warnigns 2016-05-26 10:35:33 +01:00
Robert Osfield
304c048d84 Fixed shadows warnings 2016-05-26 10:24:44 +01:00
Robert Osfield
40f4cdb1ce Fixed shadows warnings 2016-05-26 10:24:31 +01:00
Robert Osfield
3db6aa255f Removed redundent #if OSG_USE_BOUND block 2016-05-19 17:38:50 +01:00
Christian Buchner
2ef6909d9b I am hereby submitting a deferred rendering code sample, originally written by Michael Kapelko in 2013. I am submitting this code with his approval.
Deferred rendering is now the de-facto standard rendering technique in many modern game engines, hence I think it is important to have this technique demonstrated in an osg code example.

This particular sample adds soft shadows as well as bump mapping into the rendering pipeline. The image files whitemetal_diffuse.jpg and whitemetal_normal.jpg from OpenSceneGraph-Data images folder are required (The OSG_FILE_PATH environment variable must be set correctly)

Two additional osgt models are included with the demo (best to also put them into OpenSceneGraph-Data, I think.

The shaders are currently defined in separate .frag and .vert files.
2016-05-19 17:20:29 +01:00
Robert Osfield
fe6238d126 Added osg::GraphicsContext::WindowingSystemInterfaces singleton for managing multiple WIndowinSystemInterface
implementations being registered at the same time.

One usage case for this functionality to support usage of Wayland and X11 in the same version of the osgViewer.

As part of the new functionality there is now a osg::GraphicsContext::Traits::windowingSystemPreferrence string
that default to empty, but if defined will ensure that a specific WindowingSystemInterface is utilized when
you do a generic call like osg::createGraphicsContext().

Also implemented is standard proxy object for registering the new contexts and removing them automatically, and
declaration of standard graphicswindow_name() C entry point to help with static build linking.
2016-05-16 13:45:31 +01:00
Robert Osfield
cb2af961db From Jannik Heller, Wrong function call in setTextureAttributeAndModes
"From I think that this piece of code in StateSet::setTextureAttributeAndModes is a copy&paste mistake:

            OSG_NOTICE<<"Warning: non texture attribute '"<<attribute->className()<<"' passed to setTextureAttributeAndModes(unit,attr,value), "<<std::endl;
            OSG_NOTICE<<"         assuming setAttributeAndModes(attr,value) instead."<<std::endl;
            OSG_NOTICE<<"         please change calling code to use appropriate call."<<std::endl;
            setAttribute(attribute,value);

As per the warning message it should be calling setAttributeAndModes(attribute,value); ."
2016-03-11 15:35:07 +00:00
Robert Osfield
67202b2662 From Romain Ouabdelkader, "This is a fix for osgText to calculate kerning and to load glyph3D with the text's font resolution.
Font::getKerning(...), Font::getGlyph3D(...) doesn't ask for a font resolution so it uses the last font resolution requested by Font:: getGlyph(...).
This can leads to different results depending of the precedent call to Font::getGlyph(...).
See http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2016-January/271952.html for more infos.

This fix adds a font resolution parameter to Font::getKerning(...), Font::getGlyph3D(...) and to the font implementations.
This was made under the base revision r15182."
2016-02-15 13:30:39 +00:00
Robert Osfield
2e7cfe7efa From Ravi Mathur, OSX/Clang 7.0.0 build fix 2016-01-19 15:39:46 +00:00
Robert Osfield
55a8f4abbc Renamed DrawableUpdate/Event/Cull callbacks to use new include/osg/Callback versions 2016-01-19 11:39:28 +00:00
Robert Osfield
e8fd414661 Fixed line endings 2016-01-19 11:35:13 +00:00
Robert Osfield
30dc6a9428 Fixed line endings 2016-01-19 11:25:30 +00:00
Robert Osfield
e9179aaa4b Added window size, state and stats event handlers to viewer to help with QA'ing simplification results. 2016-01-18 11:49:18 +00:00
Robert Osfield
dd996a3289 Introduced CMake option OSG_PROVIDE_READFILE option that defaults to ON, but when switched to OFF disables the building of the osgDB::read*File() methods,
forcing users to use osgDB::readRef*File() methods.  The later is preferable as it closes a potential threading bug when using paging databases in conjunction
with the osgDB::Registry Object Cache.  This threading bug occurs when one thread gets an object from the Cache via an osgDB::read*File() call where only
a pointer to the object is passed back, so taking a reference to the object is delayed till it gets reassigned to a ref_ptr<>, but at the same time another
thread calls a flush of the Object Cache deleting this object as it's referenceCount is now zero.  Using osgDB::readREf*File() makes sure the a ref_ptr<> is
passed back and the referenceCount never goes to zero.

To ensure the OSG builds when OSG_PROVIDE_READFILE is to OFF the many cases of osgDB::read*File() usage had to be replaced with a ref_ptr<> osgDB::readRef*File()
usage.  The avoid this change causing lots of other client code to be rewritten to handle the use of ref_ptr<> in place of C pointer I introduced a serious of
templte methods in various class to adapt ref_ptr<> to the underly C pointer to be passed to old OSG API's, example of this is found in include/osg/Group:

    bool addChild(Node* child); // old method which can only be used with a Node*

    tempalte<class T> bool addChild(const osg::ref_ptr<T>& child) { return addChild(child.get()); } // adapter template method

These changes together cover 149 modified files, so it's a large submission. This extent of changes are warrent to make use of the Object Cache
and multi-threaded loaded more robust.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15164 16af8721-9629-0410-8352-f15c8da7e697
2015-10-22 13:42:19 +00:00
Robert Osfield
161246d864 Refactored the GL object deletion management to use new osg::GraphicsObjectManager/GLObjectManager base classes, and osg::ContextData container.
This approach unifies much of the code handling the clean up of OpenGL graphics data, avoids lots of local mutexes and static variables that were previously required,
and enables the clean up scheme to be easily extended by users providing their own GraphicsObjectManager subclasses.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15130 16af8721-9629-0410-8352-f15c8da7e697
2015-09-23 09:47:34 +00:00
Robert Osfield
0dd625f17e Added explicit initialization of osg::Referenced(true) to osg::Operation subclasses as it uses virtual inhertiance from osg::Referenced.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15025 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 15:46:47 +00:00
Robert Osfield
2208303496 Warning fixes for Clang-3.6
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15016 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 11:11:58 +00:00
Robert Osfield
37d051af5e Added output of HUD scene graph to hud.osgt and hud.osgb for testing purposes.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14901 16af8721-9629-0410-8352-f15c8da7e697
2015-06-09 09:44:37 +00:00
Robert Osfield
fd806293be From KOS, build fix for osg::Uniform::Callback to osg::UniformCallback change
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14889 16af8721-9629-0410-8352-f15c8da7e697
2015-06-03 09:07:41 +00:00
Robert Osfield
80791c6972 Changed name of UniformCallback to UniformBufferCallback to avoid conflict with changes to come to the osg::Uniform::Callback -> osg::UniformCallback.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14884 16af8721-9629-0410-8352-f15c8da7e697
2015-06-02 09:18:19 +00:00
Robert Osfield
d14a602a59 From Jannik Heller, typo fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14882 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 13:11:49 +00:00
Robert Osfield
820166b49d Rewrote the Text3D bevel implementation to automatically adjust bevel thickness to avoid overalapping and erronous tesselation.
Added osgText::Bevel::s/getRoundedConcaveJunctions(bool) to control how the bevel should be tessellated around concave junctions on the glyph boundary.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14871 16af8721-9629-0410-8352-f15c8da7e697
2015-05-26 10:05:47 +00:00
Robert Osfield
f66b430476 Comment out debug notification
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14857 16af8721-9629-0410-8352-f15c8da7e697
2015-04-23 12:58:27 +00:00
Robert Osfield
e08fd168f6 Build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14850 16af8721-9629-0410-8352-f15c8da7e697
2015-04-20 10:36:42 +00:00
Robert Osfield
a583b306c5 Added --test-NodeMask option to test crash when a parent of osgmanipulator::AntiSquish node has a NodeMask set to 0x0.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14842 16af8721-9629-0410-8352-f15c8da7e697
2015-04-17 13:22:07 +00:00
Robert Osfield
87122ca369 Fixed typo of SEPARATE enums
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14833 16af8721-9629-0410-8352-f15c8da7e697
2015-04-13 11:48:28 +00:00
Robert Osfield
0a1db3d6fc From Jannik Heller, typo fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14832 16af8721-9629-0410-8352-f15c8da7e697
2015-04-13 10:43:56 +00:00
Robert Osfield
0335ea3760 Added passing of command line arguments to viewer construction to allow one to specify extra controls for the viewer such as window size etc.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14829 16af8721-9629-0410-8352-f15c8da7e697
2015-04-13 08:55:08 +00:00
Robert Osfield
595a048319 Added WindowSizeHandler to osgmanipulator example
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14827 16af8721-9629-0410-8352-f15c8da7e697
2015-04-09 18:38:53 +00:00
Robert Osfield
70b5297575 From Jannik Heller, typo fixes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14826 16af8721-9629-0410-8352-f15c8da7e697
2015-04-07 18:01:12 +00:00
Robert Osfield
abdb23e367 From Janik Heller, clean up of drawable/node usage
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14824 16af8721-9629-0410-8352-f15c8da7e697
2015-04-07 15:53:17 +00:00
Robert Osfield
31488eeba1 Removed unused ShapesToGeometriesVisitor.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14823 16af8721-9629-0410-8352-f15c8da7e697
2015-04-07 15:52:02 +00:00
Robert Osfield
5229280901 Added --subload command line option and test subload callback for testing purposes
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14812 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 19:29:02 +00:00
Robert Osfield
a7ba138dc7 Introduced osg::Camera::resize(..) method and associated enum thus:
enum ResizeMask
        {
            RESIZE_VIEWPORT=1,
            RESIZE_ATTACHMENTS=2,
            RESIZE_PROJECTIONMATRIX=4,
            RESIZE_DEFAULT=RESIZE_VIEWPORT|RESIZE_ATTACHMENTS
        };

        /** Resize, to the specified width and height, the viewport, attachments and projection matrix according to the resizeMask provided.
          * Note, the adjustment of the projection matrix is done if the RESIZE_PROJECTIONMATRIX mask to set and according to the rules specified in the ProjectionResizePolicy. */
        void resize(int width, int height, int resizeMask=RESIZE_DEFAULT);



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14811 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 16:23:43 +00:00
Robert Osfield
99f7bfab3b Introduced Camera::resizeAttachments(int width, int height) to resize all the Texture and Image assigned the the Camera attachments.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14810 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 15:08:13 +00:00
Robert Osfield
296c12a8e9 Refactor the RTT Camera resize code into a seperate Callback method in prep for this all being done by a single Camera API call.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14809 16af8721-9629-0410-8352-f15c8da7e697
2015-03-31 10:41:33 +00:00
Robert Osfield
06e6f368fc Added StatsHandler to osgtessellationshaders example to test out rendering bug associated with stats rendering.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14807 16af8721-9629-0410-8352-f15c8da7e697
2015-03-23 11:36:02 +00:00
Robert Osfield
890aea9537 Added event handle to alter the RTT Camera's dimensions to follow the windows resizes.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14806 16af8721-9629-0410-8352-f15c8da7e697
2015-03-20 17:58:34 +00:00
Robert Osfield
6854d2968f From Jannik Heller, "Fix for Qt4 multi-threaded crash. This patch adds the AA_X11InitThreads flag to the QApplication setup, meaning QT will call XInitThreads for us. This also bumps the required QT version to 4.8+, because the AA_X11InitThreads flag was introduced in that version. If that is not acceptable, we could add a QT_VERSION >= 0x040800 guard, or manually call XInitThreads() instead. Let me know what you think."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14804 16af8721-9629-0410-8352-f15c8da7e697
2015-03-20 11:48:21 +00:00
Robert Osfield
63a3595aab Added Texture wrap setting to CLAMP_TO_EDGE to fix rendering problem when running the default osgdistortion example
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14803 16af8721-9629-0410-8352-f15c8da7e697
2015-03-19 10:49:17 +00:00
Robert Osfield
e6e39e7924 Refactored the command line setup to enable better control of set up.
Added WindowSizeHandler to allow for adjustment of window size.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14791 16af8721-9629-0410-8352-f15c8da7e697
2015-03-16 12:13:44 +00:00
Robert Osfield
a88fa6f7b7 Added --play-mode [ONCE, STAY, LOOP, PPONG] to help with testing.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14788 16af8721-9629-0410-8352-f15c8da7e697
2015-03-16 10:07:13 +00:00
Robert Osfield
75b9cd3627 Completed support for assigning 3D osg::Image to osg::Texture2DArray.
Improved the osgtexture2DArray example to add --mipmap and --packed command line options to help with testing.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14775 16af8721-9629-0410-8352-f15c8da7e697
2015-03-11 17:27:08 +00:00
Robert Osfield
b6acb1a8d3 Updated the comments to be more relevant
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14774 16af8721-9629-0410-8352-f15c8da7e697
2015-03-11 15:44:23 +00:00
Robert Osfield
d97e01c520 Work in progress on new osgtexture2DArray example
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14772 16af8721-9629-0410-8352-f15c8da7e697
2015-03-10 18:07:17 +00:00
Robert Osfield
26d1679248 Removed the experiemental osgPresentation classes. These are only partially functional and not appropriate for the stable OSG-3.4 release
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14758 16af8721-9629-0410-8352-f15c8da7e697
2015-03-04 17:42:30 +00:00
Robert Osfield
1d9e7f144b From Michael McDonnel, "The tessellation shader example has a small bug.The middle of the
geometry is clipped as soon as it is tessellated. The clipping is
probably caused by rounding errors because it is only in one spot. The
clipping disappears when the camera is moved, and reappears when it is
moved back. Expanding the the bounding box fixed the clipping bug."

Tweaked by Robert Osfield to expand it to a -1 to 1 unit box.
Actual clipping bug is not due to rounding errors but the shaders creating vertices outside the bounding box of the original input vertices


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14747 16af8721-9629-0410-8352-f15c8da7e697
2015-03-02 12:09:25 +00:00
Robert Osfield
0a83632f0a Fixed StateSet::Define names to match OpenSceneGraph-Data/shaders.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14745 16af8721-9629-0410-8352-f15c8da7e697
2015-03-01 15:20:37 +00:00
Robert Osfield
d03b38dea8 Fixes for warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14736 16af8721-9629-0410-8352-f15c8da7e697
2015-02-27 04:29:30 +00:00
Robert Osfield
30a62bc4ad From Jonathan Greig, "I was testing out the example and it works fine as a standalone example, but I found that it didn't work as expected when adding the class to some existing code I have to test it out. The osg widget was appearing but it didn't appear to be updating. After tweaking it to pass on the parent QWidget pointer from my code, it worked as expected. I added the WindowFlags to the attached file for good measure. If you look at the Qt Documentation for QWidget ( http://doc.qt.io/qt-5/qwidget.html#QWidget ), you'll see that is exactly where I got this from. When subclassing a widget as such, you should allow the user to pass in the parent at least, considering that has a major effect on how or if Qt may clean up the memory."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14718 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 19:19:37 +00:00
Robert Osfield
47db2da8b4 From Andreas Henne, Support for GL3 core profile in osgText
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14717 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 18:56:29 +00:00
Robert Osfield
7d50c8e634 From Michael McDonnell, "I have changed the code so that the plus key increases both the inner
and outer tessellation. The minus key decrease both the inner and
outer tessellation. You can still use the arrow keys to control inner
and outer tessellation separately."

From Robert Osfield, clean up the code to fix warnings and make the coding style more consistent with the rest of the OSG.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14716 16af8721-9629-0410-8352-f15c8da7e697
2015-02-25 16:59:43 +00:00
Robert Osfield
1320c923ca Changed the toggle of defines so that it works with assumed defaults now set up by the GeometryPool so that when toggling it doesn't have a delay in what the user would expect
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14708 16af8721-9629-0410-8352-f15c8da7e697
2015-02-20 15:12:57 +00:00
Robert Osfield
afbf20eba9 First step of refactoring the osg::Program management in osgTerrain::GeometryPool for better performance by placing default osg::Program and shader defines on a single StateSet below the osgTerrain::Terrain
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14704 16af8721-9629-0410-8352-f15c8da7e697
2015-02-20 15:02:43 +00:00
Robert Osfield
8546e911fc Removed GL_ usage in defines
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14697 16af8721-9629-0410-8352-f15c8da7e697
2015-02-17 19:22:37 +00:00
Robert Osfield
77b8962bcc Deprecated the old ShaderComposition example code so that it's now only invoked if you add a --old to the osgshadercomposition command line.
Introduced a new shader composition example based on the new #pragama and #define based GLSL shader/osg::StateSet::setDefine() functionality now built into the core OSG.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14692 16af8721-9629-0410-8352-f15c8da7e697
2015-02-13 10:56:59 +00:00
Robert Osfield
b38c6258bf Added support for new #pragam(atic) shader composition to new displacement mapping technique
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14683 16af8721-9629-0410-8352-f15c8da7e697
2015-02-10 17:20:26 +00:00
Robert Osfield
22cf4c18c3 Added MultiTextureControl event handling of shift 012 i.e. ')', '!', '"' and 'A' to toggle full on for each of the respective or all texture units.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14674 16af8721-9629-0410-8352-f15c8da7e697
2015-01-23 13:50:12 +00:00
Robert Osfield
4a668d53c5 Fixed warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14670 16af8721-9629-0410-8352-f15c8da7e697
2015-01-22 15:07:50 +00:00
Robert Osfield
8b384baca9 From Julien Valentin, "To sum up changes, I had:
-some extensions in GLExtensions
  - GL_TEXTURE_BUFFER as target in osg::StateSet
  - a VBO based transform feed back example
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14651 16af8721-9629-0410-8352-f15c8da7e697
2015-01-06 17:12:51 +00:00
Robert Osfield
34177d3f63 Fixed warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14615 16af8721-9629-0410-8352-f15c8da7e697
2014-12-18 11:09:43 +00:00
Robert Osfield
adf9596316 Added support for using SDL2 to the osgmovie to enable it to handle floating point audio formats
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14610 16af8721-9629-0410-8352-f15c8da7e697
2014-12-17 19:21:32 +00:00
Robert Osfield
811dde86c8 Build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14601 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 18:23:32 +00:00
Robert Osfield
1b6e50a2dd From Marcus Hein, Added support for OpenGL SSBO and SSBB via osg::ShaderStorageBufferObject and osg::ShaderStorageBufferBinding to core OSG library, and added new osgSSBO example
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14599 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 12:23:04 +00:00
Robert Osfield
3c07921dee Removed old GL2Extensions class, replacing it with a typedef to GL2Extensions
Removed old includes to include/osg/GL2Extensions


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14594 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 10:44:58 +00:00
Robert Osfield
485709f708 Moved GL2Extensions functionality into the include/osg/GLExtensions header and new GLExtensions object.
Moved the #defines into new include/osg/GLDefines
Converted all GL2Extensions usage to GLExtensions usage


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14593 16af8721-9629-0410-8352-f15c8da7e697
2014-12-10 10:38:12 +00:00
Robert Osfield
d32cd203a2 From Wand Rui, "I've rewritten the osgblenddrawbuffers example to use the new BlendFunci and Capability classes. Hope it will tell others how to make use of the new functionality and why they are important in modern MRT-based applications."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14587 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 19:20:05 +00:00
Robert Osfield
43049ebcf1 Moved FBO Extensions into GL2Extensions.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14586 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 18:30:28 +00:00
Robert Osfield
cceee38727 Moved Texture*::Extensions functionality into GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14581 16af8721-9629-0410-8352-f15c8da7e697
2014-12-09 10:05:59 +00:00
Robert Osfield
a8804e2366 MOved VertexProgram and FragmentProgram::Extensions into GL2Extensions.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14580 16af8721-9629-0410-8352-f15c8da7e697
2014-12-08 16:08:44 +00:00
Robert Osfield
bc424bc54f MOved SampleMaski::Extensions into osg::GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14577 16af8721-9629-0410-8352-f15c8da7e697
2014-12-07 17:31:49 +00:00
Robert Osfield
1ce8029f39 Fixed windows build warnings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14574 16af8721-9629-0410-8352-f15c8da7e697
2014-12-05 10:37:20 +00:00
Robert Osfield
d02c0bdc49 Moved GLBufferObject::Extensions structure into osg::GL2Extensions
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14570 16af8721-9629-0410-8352-f15c8da7e697
2014-12-04 18:13:11 +00:00
Robert Osfield
69407f4054 Removed redundent spaces
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14569 16af8721-9629-0410-8352-f15c8da7e697
2014-12-04 18:12:07 +00:00
Robert Osfield
66da1328f8 Ported GL2Extentions across to using the new GL extensions approach - cutting code count by 3000 lines!
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14566 16af8721-9629-0410-8352-f15c8da7e697
2014-12-04 16:22:31 +00:00
Robert Osfield
5efe60dcf5 Added osg::Capability and Cabibilityi base classes to wrap up glEnable/glDisable + glEnablei/glDisablei functionality, with osg::Enablei and osg::Disablei concrete implementations.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14564 16af8721-9629-0410-8352-f15c8da7e697
2014-12-03 17:31:16 +00:00
Robert Osfield
0ce96fbe8b Fixed typo
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14561 16af8721-9629-0410-8352-f15c8da7e697
2014-12-02 15:21:24 +00:00
Robert Osfield
0be132c07c Fixed warnings.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14539 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 16:04:33 +00:00
Robert Osfield
dfb0b2ab8e Renamed ShaderTerrain to DisplacementMappingTechnique and moved it from the osgterrain example testbed into the osgTerrain NodeKit
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14534 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 14:04:20 +00:00
Robert Osfield
d9f93f9d1a Moved osgTerrain::GeometryPool from osgterrain example into osgTerrain NodeKit
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14533 16af8721-9629-0410-8352-f15c8da7e697
2014-11-26 13:36:28 +00:00
Robert Osfield
4c5a1885d2 From PawelKsiezopolski, "This submission contains a new example for OSG : a geometry instancing rendering
algorithm consisting of two consequent phases :

- first phase is a GLSL shader performing object culling and LOD picking ( a culling shader ).
  Every culled object is represented as GL_POINT in the input osg::Geometry.
  The output of the culling shader is a set of object LODs that need to be rendered.
  The output is stored in texture buffer objects. No pixel is drawn to the screen
  because GL_RASTERIZER_DISCARD mode is used.

- second phase draws osg::Geometry containing merged LODs using glDrawArraysIndirect()
  function. Information about quantity of instances to render, its positions and other
  parameters is sourced from texture buffer objects filled in the first phase.

The example uses various OpenGL 4.2 features such as texture buffer objects,
atomic counters, image units and functions defined in GL_ARB_shader_image_load_store
extension to achieve its goal and thus will not work on graphic cards with older OpenGL
versions.

The example was tested on Linux and Windows with NVidia 570 and 580 cards.
The tests on AMD cards were not conducted ( due to lack of it ).
The tests were performed using OSG revision 14088.

The main advantages of this rendering method :
- instanced rendering capable of drawing thousands of different objects with
  almost no CPU intervention  ( cull and draw times are close to 0 ms ).
- input objects may be sourced from any OSG graph ( for example - information about
  object points may be stored in a PagedLOD graph. This way we may cover the whole
  countries with trees, buildings and other objects ).
  Furthermore if we create osgDB plugins that generate data on the fly, we may
  generate information for every grass blade for that country.
- every object may have its own parameters and thus may be distinct from other objects
  of the same type.
- relatively low memory footprint ( single object information is stored in a few
  vertex attributes ).
- no GPU->CPU roundtrip typical for such methods ( method uses atomic counters
  and glDrawArraysIndirect() function instead of OpenGL queries. This way
  information about quantity of rendered objects never goes back to CPU.
  The typical GPU->CPU roundtrip cost is about 2 ms ).
- this example also shows how to render dynamic objects ( objects that may change
  its position ) with moving parts ( like car wheels or airplane propellers ) .
  The obvious extension to that dynamic method would be the animated crowd rendering.
- rendered objects may be easily replaced ( there is no need to process the whole
  OSG graphs, because these graphs store only positional information ).

The main disadvantages of a method :
- the maximum quantity of objects to render must be known beforehand
  ( because texture buffer objects holding data between phases have constant size ).
- OSG statistics are flawed ( they don't know anymore how many objects are drawn ).
- osgUtil::Intersection does not work

Example application may be used to make some performance tests, so below you
will find some extended parameter description :
--skip-dynamic       - skip rendering of dynamic objects if you only want to
                       observe static object statistics
--skip-static        - the same for static objects
--dynamic-area-size  - size of the area for dynamic rendering. Default = 1000 meters
                       ( square 1000m x 1000m ). Along with density defines
                       how many dynamic objects is there in the example.
--static-area-size   - the same for static objects. Default = 2000 meters
                       ( square 2000m x 2000m ).

Example application defines some parameters (density, LOD ranges, object's triangle count).
You may manipulate its values using below described modifiers:
--density-modifier   - density modifier in percent. Default = 100%.
                       Density ( along with LOD ranges ) defines maximum
                       quantity of rendered objects. registerType() function
                       accepts maximum density ( in objects per square kilometer )
                       as its parameter.
--lod-modifier       - defines the LOD ranges. Default = 100%.
--triangle-modifier  - defines the number of triangles in finally rendered objects.
                       Default = 100 %.
--instances-per-cell - for static rendering the application builds OSG graph using
                       InstanceCell class ( this class is a modified version of Cell class
                       from osgforest example - it builds simple quadtree from a list
                       of static instances ). This parameter defines maximum number
                       of instances in a single osg::Group in quadtree.
                       If, for example, you modify it to value=100, you will see
                       really big cull time in OSG statistics ( because resulting
                       tree generated by InstanceCell will be very deep ).
                       Default value = 4096 .
--export-objects     - write object geometries and quadtree of instances to osgt files
                       for later analysis.
--use-multi-draw     - use glMultiDrawArraysIndirect() instead of glDrawArraysIndirect() in a
                       draw shader. Thanks to this we may render all ( different ) objects
                       using only one draw call. Requires OpenGL version 4.3 and some more
                       work from me, because now it does not work ( probably I implemented
                       it wrong, or Windows NVidia driver has errors, because it hangs
                       the apllication at the moment ).

This application is inspired by Daniel Rákos work : "GPU based dynamic geometry LOD" that
may be found under this address : http://rastergrid.com/blog/2010/10/gpu-based-dynamic-geometry-lod/
There are however some differences :
- Daniel Rákos uses GL queries to count objects to render, while this example
  uses atomic counters ( no GPU->CPU roundtrip )
- this example does not use transform feedback buffers to store intermediate data
  ( it uses texture buffer objects instead ).
- I use only the vertex shader to cull objects, whereas Daniel Rákos uses vertex shader
  and geometry shader ( because only geometry shader can send more than one primitive
  to transform feedback buffers ).
- objects in the example are drawn using glDrawArraysIndirect() function,
  instead of glDrawElementsInstanced().

Finally there are some things to consider/discuss  :
- the whole algorithm exploits nice OpenGL feature that any GL buffer
  may be bound as any type of buffer ( in our example a buffer is once bound
  as a texture buffer object, and later is bound as GL_DRAW_INDIRECT_BUFFER ).
  osg::TextureBuffer class has one handy method to do that trick ( bindBufferAs() ),
  and new primitive sets use osg::TextureBuffer as input.
  For now I added new primitive sets to example ( DrawArraysIndirect and
  MultiDrawArraysIndirect defined in examples/osggpucull/DrawIndirectPrimitiveSet.h ),
  but if Robert will accept its current implementations ( I mean - primitive
  sets that have osg::TextureBuffer in constructor ), I may add it to
  osg/include/PrimitiveSet header.
- I used BufferTemplate class writen and published by Aurelien in submission forum
  some time ago. For some reason this class never got into osg/include, but is
  really needed during creation of UBOs, TBOs, and possibly SSBOs in the future.
  I added std::vector specialization to that template class.
- I needed to create similar osg::Geometries with variable number of vertices
  ( to create different LODs in my example ). For this reason I've written
  some code allowing me to create osg::Geometries from osg::Shape descendants.
  This code may be found in ShapeToGeometry.* files. Examples of use are in
  osggpucull.cpp . The question is : should this code stay in example, or should
  it be moved to osgUtil ?
- this remark is important for NVidia cards on Linux and Windows : if
  you have "Sync to VBlank" turned ON in nvidia-settings and you want to see
  real GPU times in OSG statistics window, you must set the power management
  settings to "Prefer maximum performance", because when "Adaptive mode" is used,
  the graphic card's clock may be slowed down by the driver during program execution
  ( On Linux when OpenGL application starts in adaptive mode, clock should work
  as fast as possible, but after one minute of program execution, the clock slows down ).
  This happens when GPU time in OSG statistics window is shorter than 3 ms.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14531 16af8721-9629-0410-8352-f15c8da7e697
2014-11-25 10:58:23 +00:00
Robert Osfield
2a8d894168 Fixed osgsimplegl3 example's set up of the main camera.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14524 16af8721-9629-0410-8352-f15c8da7e697
2014-11-24 14:09:14 +00:00
Robert Osfield
f49d7ae110 Added --db-affinit cpuNum option to osgterrain example to illustrate how to set the thead affinity of the DatabasePager threads.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14516 16af8721-9629-0410-8352-f15c8da7e697
2014-11-21 14:46:08 +00:00
Robert Osfield
34863fe2d2 From Wang Rui, "The submission includes some fixes for osgQt library and osgQtWidgets example: (1) QTextEdit now works with mouse/drag events, (2) scrollbars will change when OSG window is resizing, (3) improve rendering efficiency of QGraphicsViewAdapter so that it works with complex Qt UI, (4) add new setBackgroundWidget() method to indicate a 'background widget', which will ignore mouse/key events on it and pass them to the 3D scene."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14482 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 11:30:53 +00:00
Robert Osfield
5f45a39f28 Changed the way that the cell size is passed to the shader
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14481 16af8721-9629-0410-8352-f15c8da7e697
2014-11-19 10:43:07 +00:00
Robert Osfield
6661deeb24 Added use of GL_TRIANGLE_STRIP to cut down the size of the primitive indices required.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14476 16af8721-9629-0410-8352-f15c8da7e697
2014-11-14 17:44:20 +00:00
Robert Osfield
bff5b0261b Implemented skirt functionality
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14475 16af8721-9629-0410-8352-f15c8da7e697
2014-11-14 16:47:32 +00:00
Robert Osfield
7a33cc00cd Improvements to the ShaderTerrain experiemental terrain rendering technique.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14466 16af8721-9629-0410-8352-f15c8da7e697
2014-11-04 20:07:40 +00:00
Robert Osfield
28a676e105 Replaced use of while(isRunning()) { YieldCurrentThread(); } style loops with use of join() to avoid false positives being reported by valgrind when using the helgrind tool for thread debugging.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14460 16af8721-9629-0410-8352-f15c8da7e697
2014-11-04 10:46:59 +00:00
Robert Osfield
997ee30039 Added experimental osgTerrain::ShaderTerrain TerrainTechnique to osgterrain example to flesh out new shader based displacement mapping approach to osgTerrain databases.
Requires shader files place in OpenSceneGraph-Data/shaders from OpenSceneGraph-Data's svn/trunk to function.

Run osgterrain example with --shader command line option to select displacement mapping shader approach.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14458 16af8721-9629-0410-8352-f15c8da7e697
2014-10-21 15:08:44 +00:00
Robert Osfield
acbad2424e Changed osgvolume example to use the new tf plugin rather than having local code for reading transfer function
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14450 16af8721-9629-0410-8352-f15c8da7e697
2014-09-16 17:40:13 +00:00
Robert Osfield
0db0bcdd5e Build fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14439 16af8721-9629-0410-8352-f15c8da7e697
2014-09-08 08:53:23 +00:00