Commit Graph

2178 Commits

Author SHA1 Message Date
Robert Osfield
5d03bb9a2b From Jannik Heller, "This submission fixes a stuttering issue that may occur when occlusion query nodes are in view. The problem is that OSG retrieves the occlusion query result without first checking if it's available (GL_QUERY_RESULT_AVAILABLE). Thus, the driver has to sync with the GPU i.e. wait for all queued draw calls to complete. This is particularly bad in V-Synced situations where the driver may be using multi frame queueing techniques - coupled with the fact that OSG only runs an occlusion query every 5th frame, results in very unpleasant stuttering in some situations.
The change I made is to check GL_QUERY_RESULT_AVAILABLE before retrieving the query, to ensure that there won't be a stall. If the query result is not available yet, we'll leave it alone and try again in the next frame.

Had to make a few more changes than I'd liked, mostly because the TestResult mechanism wasn't designed for holding on to query objects for more than one frame. As well, I'm thinking that RetrieveQueriesCallback and ClearQueriesCallback could be merged together, if we wanted to go for more refactoring. For though now my strategy is to make as little changes as possible. Let me know what you think of the patch."
2016-03-01 10:37:41 +00:00
Robert Osfield
98ca24ff4e From Laurens Voerman, "a few additions in the repository (asDrawableEventCallback / asDrawableCullCallback) made this version a bit outdated,
so I get so new warnings. This update can fix those warnings."
2016-02-17 15:09:14 +00:00
Robert Osfield
937ef73521 From Laurens Loerman, Fix for "Visual Studio 2013 gives me a large amount (2778) of warnings about inheritance via dominace (C4250)." 2016-02-15 12:37:05 +00:00
Robert Osfield
8cefa05e3a From "Jannik Heller", I just updated to the latest commit and noticed that drawable cull callbacks were no longer working. As it turns out there was a missing implementation of the asDrawableCullCallback() and asDrawableEventCallback(), after implementing these methods everything is working as expected. 2016-02-04 20:15:14 +00:00
Robert Osfield
aa17f5441a From Laurens Voerman,
"E:\osg\osgSvnGit\OpenSceneGraph\include\osg/Callback(286): warning C4099: 'osg::DrawableUpdateCallback' : type name first seen using 'class' now seen using 'struct' (E:\osg\osgSvnGit\OpenSceneGraph\src\osgUtil\RenderBin.cpp)
          E:\osg\osgSvnGit\OpenSceneGraph\include\osg/Callback(27) : see declaration of 'osg::DrawableUpdateCallback'

attached is a modified version of include/osg/Callback:
changing
- struct OSG_EXPORT DrawableUpdateCallback : public virtual Callback
- {
to
+ class OSG_EXPORT DrawableUpdateCallback : public virtual Callback
+ {
+ public:

and the same changes for DrawableEventCallback and DrawableCullCallback"
2016-02-04 19:53:13 +00:00
Robert Osfield
e00977f3c2 Added OSG_EXPORT 2016-02-04 19:40:14 +00:00
Robert Osfield
f373bcf23d Added osg::resizeGLObjectBuffers(..) and osg::releaseGLObjects(..) functions to make it easier to call these methods on objects which ref_ptr<> or C pointers are held for. 2016-02-04 17:36:33 +00:00
Robert Osfield
f8306f145a Added NodeVisitor::g/setValueMap and g/setValueStack, and osg::PushPopObject and osg::PushPopValue helper classes for pushing/popping values to the NodeVisitor's ValueStack. 2016-02-04 13:12:33 +00:00
Robert Osfield
b4eb8d4597 Improved the speed of the ValueObject get/setting by utilizing typeid() and static_cast<> in place of original dynamic_cast<>'s 2016-02-04 13:10:28 +00:00
Robert Osfield
041ab29d1f Added osg::Identifer, osg::ValueMap and osg::ValueStack classes to provide a general purpose means for storing and retrieving values from map or stack containers.
Typical use will be for storing and passing values between nodes during traversals.
2016-02-04 13:04:40 +00:00
Robert Osfield
5cb486f7c5 Added osg::MultiDrawArrays which wraps up glMultiDrawArrays extension. 2016-01-22 09:47:49 +00:00
Robert Osfield
4de2fc120d Merge branch 'master' of https://github.com/openscenegraph/osg 2016-01-20 17:51:03 +00:00
Robert Osfield
8fc287c1b7 Added asUpdate/Cull/EventVisitor and asCamera/asDrawable to osg::Object and usage of these within the code base to avoid dynamic_cast<> usage. 2016-01-20 17:49:10 +00:00
Robert Osfield
1219a6d3bf Added more osg::Object::as*() methods and usage of these through the code base to avoid use of dynamic_cast<> when using UpdateVisitor/CullVisitor/EventVIisitor etc. 2016-01-20 15:13:19 +00:00
Robert Osfield
e5a7c353ae From Jannik Heller, "This submission fixes a typo in the new GLObjectManager
sheduleGLObjectForDeletion(GLuint globj);

should be

scheduleGLObjectForDeletion(GLuint globj)"
2016-01-19 14:49:56 +00:00
Robert Osfield
b3e0f83c07 From Jordi Torres, "Added TriangleLinePointIndexFunctor to osg namespace" 2016-01-19 14:22:12 +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
baaf5712c4 Added missing OSG_EXPORT 2016-01-19 09:46:20 +00:00
Robert Osfield
3e92c1fc43 Added osg::Object::asStateSet() implementation and usage to avoid use of dynamic_cast<> 2016-01-18 20:05:20 +00:00
Robert Osfield
340615de55 Replaced dynamic_cast<*Callback> with as*Callback() implementation/usage. 2016-01-18 19:04:28 +00:00
Robert Osfield
48225171e0 From Jannik Heller, "This submission fixes a bug introduced in commit 5b17e3bc2a "Introduced CMake option OSG_PROVIDE_READFILE option...". The added overload for StateSet::setAttributeAndModes was ignoring the mode setting.
"
2016-01-18 13:10:14 +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
de4a430931 From Kristofer Tingdahl, "we had a minor shadow problem with the osg-3.4 that pollutes our continuous integration"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15143 16af8721-9629-0410-8352-f15c8da7e697
2015-09-25 15:20:25 +00:00
Robert Osfield
62764a56c5 Added support for serializing Camera::ImplicitBufferAttachmentRenderMask and ImplicitBufferAttachmentResolveMask properties.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15135 16af8721-9629-0410-8352-f15c8da7e697
2015-09-24 10:52:35 +00:00
Robert Osfield
2fe4fc38bb Added missing OSG_EXPORT to fix Windows build
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15131 16af8721-9629-0410-8352-f15c8da7e697
2015-09-23 10:41:54 +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
0d72b85881 Fixed warning
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15119 16af8721-9629-0410-8352-f15c8da7e697
2015-09-04 14:24:11 +00:00
Robert Osfield
0532c93c8c Corrected the Subload::generateTextureObject() return type to make it consistent with Texture::generateTextureObject(..)
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15117 16af8721-9629-0410-8352-f15c8da7e697
2015-08-14 15:25:08 +00:00
Robert Osfield
aff6e112ec Added support for injecting GL_VENDOR strings into GLSL shaders via the new #pragma(tic) shader composition
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15078 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 17:42:05 +00:00
Robert Osfield
8ab27a20d2 Build fix for VS and installing Types
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15077 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 05:04:56 +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
435a81a905 From Pjotr Svetachov, buid fixes for VS2015.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15021 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 14:37:17 +00:00
Robert Osfield
ec8779ca6f Moved GL_ALPHA_TEST from AlphaFunc header to GLDefines header
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15002 16af8721-9629-0410-8352-f15c8da7e697
2015-07-22 14:03:24 +00:00
Robert Osfield
36352031ef Fixed typo
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14997 16af8721-9629-0410-8352-f15c8da7e697
2015-07-21 13:42:35 +00:00
Robert Osfield
1859e27501 From Terry Welsh, "fThis fixes problem where new glClipControl feature would not compile for GLES2 profile"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14943 16af8721-9629-0410-8352-f15c8da7e697
2015-07-13 08:48:46 +00:00
Robert Osfield
08893c7fcc Moved the defination of GL_MAX_VARYING_COMPONENTS to GL_3_0 block to avoid warnings of redefinition.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14933 16af8721-9629-0410-8352-f15c8da7e697
2015-07-02 08:52:55 +00:00
Robert Osfield
b4cd40cf7c From Mathias Froehlich, "Attached a new state attribute implementing the glClipControl that appeared with GL4.5."
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14928 16af8721-9629-0410-8352-f15c8da7e697
2015-06-30 09:11:00 +00:00
Robert Osfield
fe09ebfbdb From Christian Kehl, added Vec2::set(const Vec2) method
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14924 16af8721-9629-0410-8352-f15c8da7e697
2015-06-26 09:40:37 +00:00
Robert Osfield
824cc95518 Experiment with how to define GLsizeiptr.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14917 16af8721-9629-0410-8352-f15c8da7e697
2015-06-15 13:51:29 +00:00
Robert Osfield
fc9848ff19 Reverted the typdef GLfloat GLdouble for Andoid as this was causing conflicts.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14910 16af8721-9629-0410-8352-f15c8da7e697
2015-06-11 08:44:26 +00:00
Robert Osfield
bd9bd3f8b2 Added namespace around typedef to avoid conflict issues
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14903 16af8721-9629-0410-8352-f15c8da7e697
2015-06-09 12:51:38 +00:00
Robert Osfield
7e05d2fd54 Introduce osg::Object::asNode(), asNodeVisitor(), asStateAttribute() and asUniform() to replace dynamic_cast<> usage in Callback.cpp.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14902 16af8721-9629-0410-8352-f15c8da7e697
2015-06-09 10:49:34 +00:00
Robert Osfield
9222506a2c Added doxygen comment for typedef
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14888 16af8721-9629-0410-8352-f15c8da7e697
2015-06-03 09:06:44 +00:00
Robert Osfield
e3f0876e87 From Konstantin Matveyev, "I've changed osg::Uniform::Callback to osg::UniformCallback.
osg::UniformCallback inherits osg::Callback now.

I don't really now if this class should be inside osgWrappers/serializers
because StateAttributeCallback is not presented there, but i've included it in the patch.


Please see archive in the attachment.


PS
DEEP_COPY_UNIFORMS works for me.
"
Note from Robert Osfield, added typedef UniformCallback Callback for backwards compatibility.



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14885 16af8721-9629-0410-8352-f15c8da7e697
2015-06-02 09:33:22 +00:00
Robert Osfield
ba9dfb2ff6 From Albert Luaces, typo fixes.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14883 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 13:40:20 +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
78a01ce2a5 From Jannik Heller, "I have added new functions Texture::generateAndAssignTextureObject mirroring the Texture::generateTextureObject functions.
I have left the Texture::generateTextureObject functions intact as I'm not sure if/how it's used outside the core OSG. If you feel that compatibility isn't important in that area feel free to drop it.

While testing the build with OSG_USE_REF_PTR_IMPLICIT_OUTPUT_CONVERSION=OFF I found a compile error in GlyphGeometry.cpp that was entirely unrelated to the changes I've made. The fix is included in the patch.

There is one thing left to fix and that is Texture2D::SubloadCallback:

        class OSG_EXPORT SubloadCallback : public Referenced
        {
            public:
                ....
                virtual TextureObject* generateTextureObject(const Texture2D& texture, State& state) const
                {
                    return osg::Texture::generateTextureObject(&texture, state.getContextID(), GL_TEXTURE_2D);
                }
                ...
         }"
         


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14879 16af8721-9629-0410-8352-f15c8da7e697
2015-06-01 10:50:44 +00:00
Robert Osfield
f72b62a065 From Jannik Heller, fix for race condition in orphanded BufferObject handling.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14877 16af8721-9629-0410-8352-f15c8da7e697
2015-05-29 07:52:27 +00:00
Robert Osfield
5380aebfc1 From Christian Kehl, changes for making osgAndroid working with GLES1 enabled
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14862 16af8721-9629-0410-8352-f15c8da7e697
2015-04-30 14:04:51 +00:00
Robert Osfield
e52b95e084 Renamed LineSegment::intersect(BoundingSphere/Box, double/float&, double/float&) methods to LineSegment::intersectAndComputeRations(..) to avoid confusion with the change in convention for
the old intersect(BoundingBox&, float/double&, float/double&) method as it was inconsitent with the rest of the OSG including the intersect(BoundingSphere) method in how the ratio for the
second intersection was measure from - original from the end point, but now made consistent with other places in the OSG so be based on ration from start to end of segment.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14859 16af8721-9629-0410-8352-f15c8da7e697
2015-04-27 19:31:13 +00:00