Commit Graph

13352 Commits

Author SHA1 Message Date
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
79fb9abbbf updated ChangeLog
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15151 16af8721-9629-0410-8352-f15c8da7e697
2015-10-09 08:44:45 +00:00
Robert Osfield
572bb61a2d Added osg::flushAllDeletedGLObjects to clean up of graphics context after the existing osg::deleteAllGLObjects() to catch any cases where delete doesn't flush GL objects.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15150 16af8721-9629-0410-8352-f15c8da7e697
2015-10-08 15:58:24 +00:00
Robert Osfield
27962a73ee Introduced usage of OSG_INIT_SINGLETON_PROXY into DatabasePager::prototype() and Registry::instance(), removing the InitRegistry proxy object in src/osgViewer/ViewerBase.cpp.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15147 16af8721-9629-0410-8352-f15c8da7e697
2015-10-05 10:58:32 +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
ef6f2dbcfd Added fix for case when Renderer is assigned to a Camera that has now View
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15141 16af8721-9629-0410-8352-f15c8da7e697
2015-09-25 11:15:04 +00:00
Robert Osfield
e878e53cab From Curtis Rubel, "I would like to submit the attached file for inclusion in future releases of
OpenSceneGraph and the OpenThreads library.

The changes in the file simply remove a few ifndef's that currently
do not allow Linux systems to fully utilize the PThread real-time
scheduling API.

Since Linux now fully supports the PThread scheduling API it would
be beneficial to have it available to use as necessary.  I have
been testing this change since OSG release 3.3.7 and have not seen
any ill affects.

The Priority scheduling api is further protected by another ifdef:

#ifdef ALLOW_PRIORITY_SCHEDULING

that only appears to be defined in the pthreads implementation as
well.  This would make it unlikely that anyone would be affected
by this unless they are intentionally wanting to run with priority
scheduling.  In which case on Linux they would need to make
these same modifications themselves to utilize it to its full extent.

Attached file is for the current trunk as of this date.
"


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15140 16af8721-9629-0410-8352-f15c8da7e697
2015-09-25 10:11:52 +00:00
Robert Osfield
7aae720636 Refactored the way that FrameStamp is managed in osgViewer::Renderer to avoid thread conflicts
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15138 16af8721-9629-0410-8352-f15c8da7e697
2015-09-25 10:09:27 +00:00
Robert Osfield
f626d85c2b From John Hedström,"Texture2DArray support for the .osg serializer"
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15136 16af8721-9629-0410-8352-f15c8da7e697
2015-09-24 14:14:37 +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
57d0538f1e Quietened down debug messages
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15134 16af8721-9629-0410-8352-f15c8da7e697
2015-09-24 10:48:57 +00:00
Robert Osfield
80e5338194 Fixed line endings.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15132 16af8721-9629-0410-8352-f15c8da7e697
2015-09-24 09:29:03 +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
cb3396b0e5 From Jannik Heller, "I've hit what I believe to be a bug (or at the very least, an unintuitive behaviour) in the osg::Geometry copy constructor. I noticed it when using osg::clone on a Geometry with vertex buffer objects, and the copy flags DEEP_COPY_ARRAYS. To be precise, I add a Geometry to an osgUtil::IncrementalCompileOperation, then osg::clone the Geometry. I was getting reports from users of random crashes happening.
I believe the offending lines are in the osg::Geometry copy constructor:

    if ((copyop.getCopyFlags() & osg::CopyOp::DEEP_COPY_ARRAYS))
    {
        if (_useVertexBufferObjects)
        {
            // copying of arrays doesn't set up buffer objects so we'll need to force
            // Geometry to assign these, we'll do this by switching off VBO's then renabling them.
            setUseVertexBufferObjects(false);
            setUseVertexBufferObjects(true);
        }
    }

Toggling the vertex buffer objects off then on again actually touches not only the arrays controlled by DEEP_COPY_ARRAYS, but also the PrimitiveSets which are controlled by DEEP_COPY_PRIMITIVES. This means if the user has copyflags of only DEEP_COPY_ARRAYS, we are modifying arrays that belong to the original const Geometry& we are copying from. I believe this shouldn't be allowed to happen because we are using a const& specifier for the original Geometry.

In my case the osgUtil::IncrementalCompileOperation was trying to compile the geometry, while in the main thread a clone operation toggled the VBO's off and on, a crash ensues.

In the attached patch, you will find a more efficient handling of VBO's in the osg::Geometry copy constructor, so that only the Arrays that were actually deep copied have their VBO assigned, and no changes are made to Arrays that already had a valid VBO assigned. In addition, the DEEP_COPY_PRIMITIVES flag is now honored so that VBO's are set up correctly should a user copy a Geometry with only that flag.
"



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15129 16af8721-9629-0410-8352-f15c8da7e697
2015-09-04 15:35:24 +00:00
Robert Osfield
34794c5c27 From Laurens Voerman, "I found that using an ImageSequence with mode PAGE_AND_DISCARD_USED_IMAGES triggers the (3) imageThreads to run and never stop, even when no more work is to be done. This is due to a bug in the stop condition currently setting the thread to stop and wait for a signal only when no work needs to be done AND the databasepager is paused.
It should stop and wait for a signal on either of those two. Due to a few logical inversions it boils down to replacing || with &&

OLD _block->set((!_requestList.empty() || !_pager->_databasePagerThreadPaused));
NEW _block->set((!_requestList.empty() && !_pager->_databasePagerThreadPaused));//release the threads to run IF (work_to_be_done && not_paused)

This bug is present since svn rev 8663 (just before 2.6.0 release)


attached is a zip with the files:

OpenSceneGraph\include\osgDB\ImagePager



This file is valid for svn branch and stable 3.2 and 3.4
branches 2.6 - 3.0 have the same bug, but other differences in the file."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15125 16af8721-9629-0410-8352-f15c8da7e697
2015-09-04 15:04:58 +00:00
Robert Osfield
8b37ff25e7 From Laurens Voerman, "I crashed osgconv while compressing textures:
osgconv --compressed-dxt1 cow.osg cow.ive

due to different handling of the extentions in osg 3.4 and up.

attached is a zip with the files:

OpenSceneGraph\applications\osgconv\osgconv.cpp



This file is valid for svn branch and stable3.4."



git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15124 16af8721-9629-0410-8352-f15c8da7e697
2015-09-04 14:50:39 +00:00
Robert Osfield
aa96046632 From Julien Valentin, "Serializing custom geometry i ran into a crash due to a
setVertexAttribArrayList(array) with array containing NULL vertexAttrib.
I added a test in order to avoid it


Code:
void Geometry::setVertexAttribArrayList(const ArrayList& arrayList)
{
    _vertexAttribList = arrayList;

    dirtyDisplayList();

    if (_useVertexBufferObjects)
    {
        for(ArrayList::iterator itr = _vertexAttribList.begin();
            itr != _vertexAttribList.end();
            ++itr)
        {
if(itr->get())//ADDED
            addVertexBufferObjectIfRequired(itr->get());
        }
    }
}
"

and

"The bug i ran into is a crash reading osgt Geometry with null vertexattribs.
The only thing i added is a not nul check on array passed to setVertexAttribArrayList."

--------------------This line, and those below, will be ignored--

M    src/osg/Geometry.cpp


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15121 16af8721-9629-0410-8352-f15c8da7e697
2015-09-04 14:34:45 +00:00
Robert Osfield
d7cd5b1811 Updated SO version for svn/trunk.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15120 16af8721-9629-0410-8352-f15c8da7e697
2015-09-04 14:24:40 +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
53a850c671 Fixed warning by removing redundent check
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15118 16af8721-9629-0410-8352-f15c8da7e697
2015-09-04 14:23:55 +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
051ee49098 Updated shaders from OpenSceneGraph-Data with refactor of workaround to NVidia driver bug
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15110 16af8721-9629-0410-8352-f15c8da7e697
2015-08-12 10:18:09 +00:00
Robert Osfield
6a41ccf537 Added GL1 to the docs of the GL_PROFILE string
Updated the date of the 3.4.0 release in the README.


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15100 16af8721-9629-0410-8352-f15c8da7e697
2015-08-12 06:39:57 +00:00
Robert Osfield
eba1cc6e4f Refactored workaround of NVidia nan lenght() bug.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15096 16af8721-9629-0410-8352-f15c8da7e697
2015-08-11 20:06:38 +00:00
Robert Osfield
41f284b678 Moved FIND_PACKAGE(Boost) to within the individual Find scripts that actually need it rather in the root CMakeLists.txt.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15093 16af8721-9629-0410-8352-f15c8da7e697
2015-08-11 08:43:40 +00:00
Robert Osfield
b964c53445 Removed spaces
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15088 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 19:55:16 +00:00
Robert Osfield
5194d81a89 Fixed line endings
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15085 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 19:40:36 +00:00
Robert Osfield
8ebe075722 Updated built-in shaders from OpenSceneGraph-Data vesion that introduce #pragma(tic) shaders that resolve the NVidia loop iteration bug.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15083 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 19:39:23 +00:00
Robert Osfield
a2013caa47 Quietened down #pragma(tic) shader composition messages
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15079 16af8721-9629-0410-8352-f15c8da7e697
2015-08-10 19:18:54 +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
7aa2c7c10f Changed GLint64 and GLuint64 setup to use int64_t and uint64_t resptectivly respectively to avoid issues with compiling against Qt5
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15071 16af8721-9629-0410-8352-f15c8da7e697
2015-08-09 09:42:31 +00:00
Robert Osfield
583801179e Added #ifdef guards around SGIX specific parts to avoid build problems with GLES
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15069 16af8721-9629-0410-8352-f15c8da7e697
2015-08-09 09:07:05 +00:00
Robert Osfield
fde838b029 From Glenn Waldron, fix error in ZIP plugin handling of memory buffer
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15067 16af8721-9629-0410-8352-f15c8da7e697
2015-08-08 08:49:42 +00:00
Robert Osfield
cd09242520 Added checks for the validity of chached coordinate arrays.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15060 16af8721-9629-0410-8352-f15c8da7e697
2015-08-06 15:03:05 +00:00
Robert Osfield
d205919881 Updated shaders from OpenSceneGraph-Data.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15059 16af8721-9629-0410-8352-f15c8da7e697
2015-08-06 10:09:29 +00:00
Robert Osfield
687e77ddc9 From Andy Skinner, "Someone was using our code on a system that does not seem to have the SGIX symbols used in osgViewer.cpp.
I used osgSetGLExtensionsFuncPtr to remove the symbols.  I don't know how to test this path, but it did remove the symbols from libosgViewer.so.  I have also not been able yet to see if that was sufficient for our customer.

 

I did this by looking at other cases, and I tried to follow some of the same practices in PixelBufferX11, like using _useSGIX in a similar way to the previous _useGLX1_3."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15041 16af8721-9629-0410-8352-f15c8da7e697
2015-08-03 19:14:09 +00:00
Robert Osfield
e4697ae7fc From Terry Welsh, "I downloaded the Android 3rdparty deps from here
http://www.openscenegraph.org/index.php/download-section/dependencies
but was not able to use them for a while. Attached are changes to
OsgAndroidMacroUtils.cmake that allow the deps to be found by cmake.

Specifically, all FIND_PATH commands require the
NO_CMAKE_FIND_ROOT_PATH option to actually find paths. This is odd
because if you inspect CMAKE_FIND_ROOT_PATH it appears to be empty. I
would expect it to have no effect at all.

I also needed to remove quotes from this line in order for headers to be found:

set(FREETYPE_INCLUDE_DIRS "${FREETYPE_DIR}/include
${FREETYPE_DIR}/include/freetype/config")

Assuming this script worked in the past, it seems like cmake behavior
may have changed at some point. I'm using cmake version 2.8.12.2."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15036 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 13:46:57 +00:00
Robert Osfield
42884e7600 From Jannik Heller, "Here is a patch for the S3TC capability check.
On a Intel HD graphics Linux system with Mesa 10.1.3, I found that osg's Extensions::isTextureCompressionS3TCSupported() returned false, even though S3TC compressed textures *are* in fact working. I tested this by loading and rendering various DXT1, DXT3 and DXT5 compressed textures in the OSG.

"glxinfo | grep s3tc" gives:
    GL_S3_s3tc

Note, if I install the package "libtxc-dxtn-s2tc0", I get in addition:

glxinfo | grep s3tc
    GL_EXT_texture_compression_s3tc
    GL_S3_s3tc

However, S3TC compressed textures worked correctly within the OSG even without libtxc-dxtn-s2tc0 installed.

I'm not sure what the differences between these extensions are, but based on the description at https://www.opengl.org/registry/specs/S3/s3tc.txt I would assume that both will work for OSG's purposes. The attached patch changes isTextureCompressionS3TCSupported() to accept either extension."


git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15035 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 13:44:39 +00:00
Robert Osfield
55d36b544b Warning fix
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15032 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 10:59:11 +00:00
Robert Osfield
1fe7aa056b From Kristofer Tingdahl, warning fixes.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15030 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 10:54:13 +00:00
Robert Osfield
d6828651d0 Compile fix for Mingw.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15029 16af8721-9629-0410-8352-f15c8da7e697
2015-07-31 10:27:11 +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
f5ef9486bb Merged VS2013 warning fixes from OSG-3.4 branch
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15020 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 14:31:05 +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
71c6d27b57 Added missing handling of lightnumber and associate lights
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15015 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 09:23:42 +00:00
Robert Osfield
b90bbdaebf Changed the GL_HEADER_HAS_GLINT64 and GL_HEADER_HAS_GLUINT64 to use cmakedefine to improve handling of when cmake doesn't find GLint64 and GLuint64.
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15013 16af8721-9629-0410-8352-f15c8da7e697
2015-07-23 07:39:12 +00:00
Robert Osfield
7e3ac0e584 Fixed AUTHORS file
git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15011 16af8721-9629-0410-8352-f15c8da7e697
2015-07-22 17:01:03 +00:00