Commit Graph

11195 Commits

Author SHA1 Message Date
Robert Osfield
41eb850578 Fixed Coverity reported issue.
CID 11447: Unchecked dynamic_cast (FORWARD_NULL)
Dynamic cast to pointer "dynamic_cast <struct osg::NodeCallback *>(nc->clone(this))" can return null.
Assigning null: "first" = "dynamic_cast <struct osg::NodeCallback *>(nc->clone(this))".

The clone() implementation is written using macro's so that it always returns the type of Object
being cloned so it's normally safe to assume that a dynamic_cast<> will always return a valid pointer as long
as the new T that involves creates a valid object.  However, if the class being cloned doesn't correctly
implement the clone() method then their potential for the dynamic_cast to fail and will return a NULL and will
result in a memory leak of the object of paraent class that the clone would have defaulted to.

I've tightened up the CopyOp.cpp code to check the return type and added better handling of the clone in the
osg::clone() methods so thay don't have any potential mememory leaks and report warnings to OSG_WARN when
problems are encountered.  It may be more apporpriate to throw an exception so will need to ponder this
issue further.
2011-04-28 16:33:14 +00:00
Robert Osfield
c379431be3 Fixed Coverity reported issue.
CID 11403: Logically dead code (DEADCODE)
After this line, the value of "needspace" is equal to 0.
Assigning: "needspace" = "false".

Technically the report is correct, but the code is just debugging code that was there just in case
the code needed to be reviewed. This code is long since through it's debugging stage so the code
is no longer really worth keeping so I've removed it for cleanness sake.
2011-04-28 10:23:50 +00:00
Robert Osfield
f9d217ea07 Fixed Coverity reported issue.
ID 11667: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _useVertexAttribAlias is not initialized in this constructor nor in any functions that it calls.

Member variable should have been initialized but this varaible will have always been initialized in later code
before it was used anyway so wouldn't have resulted in a runtime bug.
2011-04-28 10:23:28 +00:00
Robert Osfield
bef8dedce0 Fixed Coverity reported issue.
CID 11414: Logically dead code (DEADCODE)
After this line, the value of "vboMemory" is equal to 0.
Assigning: "vboMemory" = "NULL".

Another case of debugging code paths being picked out. I have chosen to just delete these paths as the code
looks to be working fine and less code is better than more code when it comes to maintenance.
2011-04-28 10:22:20 +00:00
Robert Osfield
c32b72e8c5 Fixed Coverity reported issue. Issue is benign as all the member variables are initialized in after construction,
but I've moved this initialization into the constructor to make the code more managable.

CID 11686: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member cnt is not initialized in this constructor nor in any functions that it calls.
Non-static class member maxcnt is not initialized in this constructor nor in any functions that it calls.
Non-static class member phase is not initialized in this constructor nor in any functions that it calls.
2011-04-27 16:37:25 +00:00
Robert Osfield
718fa5b679 Fixed 2 Coverity reported issues. Both issues are benign, but I've addressed then as with the changes the
code is clean and more mantainable.

CID 11676: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member cancelMode is not initialized in this constructor nor in any functions that it calls.
Non-static class member cpunum is not initialized in this constructor nor in any functions that it calls.
Non-static class member detached is not initialized in this constructor nor in any functions that it calls.
Non-static class member isRunning is not initialized in this constructor nor in any functions that it calls.
Non-static class member stackSize is not initialized in this constructor nor in any functions that it calls.
Non-static class member threadPolicy is not initialized in this constructor nor in any functions that it calls.
Non-static class member threadPriority is not initialized in this constructor nor in any functions that it calls.
Non-static class member uniqueId is not initialized in this constructor nor in any functions that it calls.

CID 11564: Unsigned compared against 0 (NO_EFFECT)
This less-than-zero comparison of an unsigned value is never true. "cpunum < 0U".
2011-04-27 16:35:34 +00:00
Robert Osfield
91430e9c54 Fixed Coverity reported issue.
CID 11677: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _minimumNumberAccumAlphaBits is not initialized in this constructor nor in any functions that it calls.
Non-static class member _minimumNumberAccumBlueBits is not initialized in this constructor nor in any functions that it calls.
Non-static class member _minimumNumberAccumGreenBits is not initialized in this constructor nor in any functions that it calls.
Non-static class member _minimumNumberAccumRedBits is not initialized in this constructor nor in any functions that it calls.
2011-04-27 16:06:32 +00:00
Robert Osfield
688b1614ad Fixed Coverity reported issue.
CID 11690: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _frameLastUsed is not initialized in this constructor nor in any functions that it calls.
2011-04-27 16:06:10 +00:00
Robert Osfield
e962eda7d5 Fixed Coverity reported issue.
CID 11689: Uninitialized pointer field (UNINIT_CTOR)
Non-static class member _glBlendColor is not initialized in this constructor nor in any functions that it calls.
2011-04-27 16:05:37 +00:00
Robert Osfield
4751f03529 Fixed 2 Coverity reported issues.
CID 11681: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _previousHeight is not initialized in this constructor nor in any functions that it calls.
Non-static class member _previousWidth is not initialized in this constructor nor in any functions that it calls.

CID 11688: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _previousHeight is not initialized in this constructor nor in any functions that it calls.
Non-static class member _previousWidth is not initialized in this constructor nor in any functions that it calls.
2011-04-27 16:05:13 +00:00
Robert Osfield
7e6f05b864 Fixed Coverity reported issue, in this case it's a unused member variable so could just be deleted.
CID 11687: Uninitialized pointer field (UNINIT_CTOR)
Non-static class member _glBeginEndAdapter is not initialized in this constructor nor in any functions that it calls.
2011-04-27 16:04:37 +00:00
Robert Osfield
d20d2202a4 Fixed 3 Coverity reported issues. CID 11622 is a bit of false positive as for valid settings no leak would happen.
CID 11810: Uninitialized scalar field (UNINIT_CTOR)
Non-static class member _setMaxFarDistance is not initialized in this constructor nor in any functions that it calls.

CID 11811: Uninitialized pointer field (UNINIT_CTOR)
Non-static class member _displayTexturesGroupingNode is not initialized in this constructor nor in any functions that it calls.

CID 11622: Resource leak (RESOURCE_LEAK)
Calling allocation function "operator new(unsigned long long)".
Variable "<storage from new>" is not freed or pointed-to in function "osg::StateSet::StateSet()". [show details]
Assigning: "sharedStateSet" = storage returned from "new osg::StateSet".
 282    osg::StateSet* sharedStateSet = new osg::StateSet;
Variable "sharedStateSet" is not freed or pointed-to in function "osg::Object::setDataVariance(osg::Object::DataVariance)". [show details]
2011-04-27 16:03:37 +00:00
Robert Osfield
63ee77a63d Fixed Coverity reported issue.
CID 11588: Resource leak (RESOURCE_LEAK)
Calling allocation function "operator new[](unsigned long long)".
Assigning: "dataPtr" = storage returned from "new unsigned char[newTotalSize]".
2011-04-27 16:02:10 +00:00
Robert Osfield
501008f256 Fixed 2 Coverity reported issues.
Following are both false positives as the the scope they are in will always assign the object to a ref counted
structure.  I've modified the code to use ref_ptr<> to just make it clear that it's underscope, although
this is not strictly neccessary as the code is OK, I introduced this for clarity and robustness in
presence of exceptions.

CID 11586: Resource leak (RESOURCE_LEAK)
Calling allocation function "operator new(unsigned long long)".
Variable "<storage from new>" is not freed or pointed-to in function "osg::VertexBufferObject::VertexBufferObject()". [show details]
Assigning: "vbo" = storage returned from "new osg::VertexBufferObject".


CID 11587: Resource leak (RESOURCE_LEAK)
Calling allocation function "operator new(unsigned long long)".
Variable "<storage from new>" is not freed or pointed-to in function "osg::ElementBufferObject::ElementBufferObject()". [show details]
Assigning: "ebo" = storage returned from "new osg::ElementBufferObject".
2011-04-27 16:01:43 +00:00
Robert Osfield
9a4c277592 Fixed Coverity reported issue.
CID 11636: Allocation size mismatch (SIZECHECK)
"my_alloc(sizeof (struct PlyProperty) /*36*/ * elem->nprops, 1292, "..\\..\\..\\..\\src\\osgPlugins\\ply\\plyfile.cpp")" allocates memory. [show details]
Allocating a multiple of 36 bytes to pointer "other->props", which needs 8 bytes.
2011-04-27 16:00:32 +00:00
Robert Osfield
e345a7bacd Fixed 1 Coverity Low Impact issue "Unused pointer value (UNUSED_VALUE)
Pointer "indices" returned by "this->_vertexAttribList[0ULL].indices.get()" is never used."

Report highlighted the fact that later code wasn't using the indices variable when it should have been, so
potentially a higher impact that the severity suggested by Coverity.
2011-04-26 19:31:04 +00:00
Robert Osfield
c19fcd6d44 Fixed 3 Coverity Low Impact performance issues relating to "Big parameter passed by value". 2011-04-26 19:29:22 +00:00
Robert Osfield
7c49e69042 Updated version after 2.9.13 dev release 2011-04-26 15:24:21 +00:00
Robert Osfield
9b6783343c Updated ChangeLog and AUTHORS for 2.9.13 dev release 2011-04-26 14:55:19 +00:00
Robert Osfield
946e9f01fc From Mattias Helsing, "Fixes two of the osgWidget examples that were broken due to changed
virtual function prototypes in osgWidget/EventInterface"
2011-04-26 12:07:37 +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
0d97aab94f From Farshid Lashkari, "I believe their is small error in how OutputStream handles the WriteImageHint. In the "writeImage" method, it converts the WriteImageHint to an internal "decision" flag. During this conversion, it seems to be swapping the behavior for WRITE_EXTERNAL_FILE and WRITE_USE_EXTERNAL. I've attached what I believe to be the correct conversion." 2011-04-26 11:51:21 +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
a793958836 From Johannes Baeuerele, "I have extended the pvr reader plugin to support etc1 compression(GL_ETC1_RGB8_OES). The changes attached to this submission are based on today's trunk.
The pvr format which can be used as a wrapper for different compressed and uncompressed formats supports this compression algorithm. The original pvr compression uses the pvrtc format. The handling of pvrtc is already implemented in the pvr plugin. PVR provides wrapper functionality for some formats, e.g. etc or even dxt/dds.

Our target system (gles2) is able to use the etc compression format. With minor changes in the submitted files, there is no need to write a separate plugin. However the original pvr texture compression formats are not supported on our target, which is the reason for this extension.

The changes mainly consist in the definition on new enum values in the classes and headers of ReaderWriterPVR,Image and Texture. I also found some locations where the handling of the original pvr textures was not implemented. These are also part of this submission."
2011-04-21 17:04:50 +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
478e0f3ebf From Jorge Ciges, "1rst - Changes in Cmake: They make possible "make install" with the android building.
2nd - Script to use a 3rd party directory with basic libraries: libjpeg,libpng,libtiff,giflib,freetype,curl,gdal.

3rd - Change in the GLES library loading for Android. That should make GLES2 work properly.

4rth- Included two defines RGB8_OES and RGBA8_OES as a substitute in GLES for RGB8 and RGBA8

5th - OpenGL and GLSL version identification changed to recognize GLES  versions properly
"
2011-04-21 12:53:22 +00:00
Robert Osfield
cd44e63b90 From Cedric Pinson, "I have tried some model that produces crashes in the dae plugin because
of empty node:

if (GetFloat4Param(cot->getParam()->getRef(), f4)) {...}

in the model I have tested cot->getParam()->getRef() return 0x0 and make
it crahes inside GetFloat4Param.

I have added a test before calling GetFloat4Param
if (cot->getParam()->getRef() != 0 &&
GetFloat4Param(cot->getParam()->getRef(), f4)) {...}
"
2011-04-21 12:12:40 +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
4d0b96c074 From Sukender, Here is a tiny update to FileNameUtils. It brings getPathRoot() and isAbsolutePath() to the public side of the lib. 2011-04-20 19:20:28 +00:00
Robert Osfield
63cfbadc95 From Guillaume Taze, "This is a fix for the error popups which appeared when reading a corrupted file on windows. Errors are redirected to std::err instead."
Note from Robert Osfield, changed jpeg error report output from stderr to standard OSG notification system using OSG_WARN.
2011-04-20 17:15:58 +00:00
Robert Osfield
70aa087f6e Added releaseGLObjects(State*) support into osg::FrameBufferObject, osg::RenderBin and osg::RenderStage
to ensure proper clean up of FBO's on closing a graphics context.
2011-04-20 11:45:01 +00:00
Robert Osfield
f564926570 From Magnus Kessler, "A few minor fixes in the documentation strings of ReaderWriterFLT.cpp" 2011-04-19 14:19:06 +00:00
Robert Osfield
cfb19182e6 From Bradley Anderegg, "The first change just exposes the archive extension list so that
external applications can determine if an archive extension is valid.

The second change is a bug fix in Registry::read(const ReadFunctor&)
where if you pass in valid options they get wiped out after the archive
is loaded but before being passed along to the plugin."
2011-04-19 14:11:13 +00:00
Robert Osfield
3c4180d982 From Paul Martz, "To summarize the fix: OpenGL eye coords are negative outside Cartesian quadrant 1. As a result, the center of projection is eye coord (0,0), which (when used as st tex coords) looks up the lower left corner of the texture. However, in projective texturing, you usually want eye coord (0,0) to look up the center of the texture. Accomplishing this mapping requires not just a lookat and perspective transform, but also a translate and scale." 2011-04-19 13:32:25 +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
581e6fb630 Ran svn propset -R svn:eol-style native . on the OpenSceneGraph 2011-04-19 11:40:22 +00:00
Robert Osfield
c70e7bda86 Improved the handling of unitialized bounding box 2011-04-19 09:54:14 +00:00
Robert Osfield
36f755670b Cleaned up example 2011-04-19 09:53:34 +00:00
Robert Osfield
c1cd0c4f3b Updated SO version number 2011-04-18 12:58:28 +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
a74289614d From Stephan Huber, "attached you'll find some enhancements for the iphone-part of the readme." 2011-04-14 15:47:29 +00:00
Robert Osfield
c8350e0428 From Magnus Kessler, "The standard width for the windows cmd and terminals on many Unix systems is
80 columns. I reorganized some of the help strings to make the output of

 osgconv --help --all

fit to 80 columns. This avoids difficult to read line breaks added by the
terminal program itself."
2011-04-14 15:45:14 +00:00
Robert Osfield
2648723c83 Cleaned up DXT1 support 2011-04-14 15:22:43 +00:00
Robert Osfield
5fb7f69108 Added IF (WIN32) around OSG_USE_UTF8_FILENAME 2011-04-14 15:21:53 +00:00
Robert Osfield
7c004aeebc Added osgDB::Option string entries:
supportsOption("dds_dxt1_rgb","set the pixel format of DXT1 encoded images to be RGB");
        supportsOption("dds_dxt1_rgba","set the pixel format of DXT1 encoded images to be RGBA");
        supportsOption("dds_dxt1_detect_rgba","For DXT1 encode images set the pixel format according to presence of transparent pixels.");

And set the default not to modify and detect the RGB or RGBA pixel format for DXT images.
2011-04-14 10:44:37 +00:00
Robert Osfield
fc38d5b6e7 Added setting of the internal texture format 2011-04-14 09:16:09 +00:00
Robert Osfield
76445d07b0 quitened down debug output 2011-04-13 19:28:30 +00:00
Robert Osfield
b1692f1f31 Introduced new code for detecting DXT1 images catogoriesed as RGB that actually have a 1 bit alpha,
therefore re-interpreting these as RGBA.
2011-04-13 19:26:35 +00:00