Commit Graph

9988 Commits

Author SHA1 Message Date
Robert Osfield
74f7ffcd32 From Ulrich Hertlein, "ttached are some tweaks to the Obj loader that allows a program supplied osgDB::Options object to be passed through the code. This allows for caching to be used with images.
The patched loader also complains more loudly if a material library file wasn't found or if a referenced material wasn't found in the material library."
2009-11-19 12:54:52 +00:00
Robert Osfield
72b3ce7ac6 From Tugkan Calapoglu, "we started to have problems with textures after a recent svn update. I
was able to follow the problem until following addition to Texture.cpp:

// GLES doesn't cope with internal formats of 1,2,3 and 4 so map them to
the appropriate equivilants.

if (_internalFormat==1) _internalFormat = GL_ALPHA;
if (_internalFormat==2) _internalFormat = GL_LUMINANCE_ALPHA;
if (_internalFormat==3) _internalFormat = GL_RGB;
if (_internalFormat==4) _internalFormat = GL_RGBA;


The problem is that internal format "1" corresponds to GL_LUMINANCE, not
GL_ALPHA. I double checked this from the Red Book. Fixed version is
attached to the email."
2009-11-19 12:39:04 +00:00
Robert Osfield
b4a5edd82e From Jean-Sebastien Guay, "I've made a change to the ScreenCaptureHandler's addCallbackToViewer method, so that it iterates over GraphicsContexts instead of GraphicsWindows. When the viewer has a pbuffer (for offscreen rendering without a window) then it wouldn't add the WindowCaptureCallback to that context since it wasn't in the list returned by ViewerBase::getWindows(). And anyways, I originally wrote the code, and I didn't see any reason why I did it with windows instead of contexts...
I've needed to run a recorded simulation offscreen and save it to a sequence of images, and the ScreenCaptureHandler seemed to be the simplest way to do that, and with this change it's possible.


Another change: I've also added the ability to specify continuous capture of all frames, or a certain number of frames. ScreenCaptureHandler now has a setFramesToCapture(int) method. The argument will be interpreted as:

0  : don't capture
<0 : capture continuously
>0 : capture that number of frames then stop

I also added startCapture() and stopCapture() methods so that user code can start capturing (either continuously or the given number of frames) at a given point in their program. setFramesToCapture() won't start capturing, you have to call startCapture() afterwards. The handler also now has another key to toggle continuous capture (defaults to 'C').

Note that continuous capture will of course only work if the CaptureOperation writes to different files (for example, a WriteToFile with SEQUENTIAL_NUMBER mode) or does something different each time... Otherwise it will just overwrite of course. :-)

I've also taken the chance to refactor the addCallbackToViewer() method a bit too, since finding the right camera is needed in two places now.

I've tested all cases (I think). If you want to try, in osgviewer.cpp and replace the line

 // add the screen capture handler
 viewer.addEventHandler(new osgViewer::ScreenCaptureHandler);

with

 // add the screen capture handler
 osgViewer::ScreenCaptureHandler* captureHandler = new
     osgViewer::ScreenCaptureHandler(
         new osgViewer::ScreenCaptureHandler::WriteToFile(
             "screenshot", "jpg",
     osgViewer::ScreenCaptureHandler::WriteToFile::SEQUENTIAL_NUMBER),
     -1);
 viewer.addEventHandler(captureHandler);
 captureHandler->startCapture();

And vary the "-1" (put 0, 10, 50) and then use the 'c' and 'C' keys and see how it reacts.
"
2009-11-19 12:01:49 +00:00
Robert Osfield
4f6be906b3 Fixed spaces at ends of lines 2009-11-19 11:54:15 +00:00
Robert Osfield
2e11c49742 From Michael Platings, "This plugin adds support for the Autodesk FBX file format. It imports animations, including skeletal and morph animations, hence all my previous submissions to osgAnimation. The plugin won't build without the changes made in the "osgAnimation small additions" submission (14th August).
The plugin requires the FBX SDK to be installed, available from http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=6837478"
2009-11-19 11:44:44 +00:00
Robert Osfield
6cc2ce5e4a Form Roland Smeenk, "Attached is a small change to the osgWidget::EventInterface so it matches the NotifyWidget and NullWidget interface (added const). Due to this mismatch these widgets never received events.
I also changed the osgwidgetbox example so the ColorWidget is receiving events again."
2009-11-19 11:30:22 +00:00
Robert Osfield
1bc204a87f From J.P. Delport, "simple addition to make the scroll wheel work in the example." 2009-11-19 11:21:05 +00:00
Robert Osfield
ec788e92f2 From Fabien Lavignotte, "I have used the osgUtil::DelaunayTriangulator to insert roads into a
terrain. The triangulator is quite tricky to use properly but works
quite well, constraint triangulation is not an easy task... I have
encounter some crash during the development that the following patch
fix.
The two fixes are :
 - Fix in removeVerticesInside() : needs to take into account UByte and
UShort version of DrawElements to avoid a crash later
 - Fix a crash in triangulate() : detect degenerate adjacency case to
exit early form the adjacent triangle traversal loop to avoid a crash
later"
2009-11-19 11:16:58 +00:00
Robert Osfield
f38d1cdbb4 Fixed build 2009-11-19 10:47:42 +00:00
Robert Osfield
b4dffc5bf4 Updated wrappers 2009-11-19 10:12:00 +00:00
Robert Osfield
c481f022e9 From Wojciech Lewandowski, "Building on earlier Paul's submission "[osg-users] Main branch MSFBO support change", I have added implicit buffer mask variables to DisplaySettings for setting global defaults for Camera FBOs. These mask variables are named after variables in Camera class. In Paul's submission they were named _renderBufferMask & _resolveBufferMask but I renamed them to _implicitBufferAttachmentRenderMask & _implicitBufferAttachmentResolveMask. DisplaySettings implementation includes reading of environment vars and command line options. Setters and getters follow typical OSG naming convention. I also updated names of ImplictBufferAttachment enum bits to match changed naming scheme.
DisplaySettings now define COLOR and DEPTH as defaults for implicit buffers. Consequently Camera by default uses the same defaults through USE_DISPLAY_SETTINGS_MASK. However, particular Camera mask can be easily overriden through Camera::setImplicitBufferAttachmentMask method. I hope, that in this way we can have global control over implicit buffer defaults, and we can still retain fine grained control at Camera level.

I have also replaced original unsigned ints used to store masks to signed ints because complier resolves enums as signed integer (I got a number of warnings with unsigned int)."
2009-11-19 10:10:50 +00:00
Robert Osfield
80341b896d Removed include/osg/Config as it was causing problem with Windows build 2009-11-18 18:19:29 +00:00
Robert Osfield
2191e6a48d Moved the set of include/osg/Version into Cmake 2009-11-18 16:24:01 +00:00
Robert Osfield
a3f141d4b5 From Lee Butler, "The attached ZIP file contains a modified OBJ file format reader which
makes smoothing optional for verticies which do not have a normal
associated with them in the OBJ input file.  The previous behavior was
to always smooth at all verticies which did not have surface normals.
In this new implementation smoothing is on by default to be compatible
with previous behavior.  The user can now specify the "generateFacetNormals"
option to the reader to use facet normals for verticies where the OBJ
file does not specify a normal."

Note from Robert Osfield, changed "noSmoothing" naming used by Lee to "generateFacetNormals".
2009-11-18 14:08:46 +00:00
Robert Osfield
2a0497e2c1 From Pau Garcia i Quiles, "On Linux/Unix, when you change the system time (for instance, using
settimeofday), OSG animations will freeze your application because
osg::Timer uses gettimeofday internally on non-Win32 platforms. This
is wrong and should be replace with times(2) or clock_gettime(2).

The attached patch fixes the issue in a binary-compatible way by using
clock_gettime when it's available, and falling back to gettimeofday
when it's not."
2009-11-18 13:00:35 +00:00
Robert Osfield
2f854d4978 Fixed primCount default value 2009-11-18 12:50:03 +00:00
Robert Osfield
b7cabac990 From Mathias Froechlich, "Attached the collected fixes I needed to compile with all of them.
Most notable the __hpux define stuff. The __hpux__ variant seems to be not
defined which resulted in a compile error at this time. Consequently I have
replaced all occurances of __hpux__ with __hpux. And huge surprise: now osg
plugins are found and loaded correctly ...
The next notable one is the MSVC_IDE fix which makes the nmake Makefiles cmake
generator target behave like the ide one. Showed up because I started to do
scripted builds with nmake instead of devenv...
The rest is the usual bunch of stuff that just happens during normal
coding ..."
2009-11-18 12:15:29 +00:00
Robert Osfield
259daac9a9 Updated wrappers 2009-11-18 11:26:00 +00:00
Robert Osfield
4262d10217 Added osg::ShaderBinary::readShaderBinaryFile(..) static method 2009-11-18 11:25:28 +00:00
Robert Osfield
f8ab593c4b Moved across to use OSG_FIXED_FUNCTION_AVAILABLE 2009-11-17 15:54:20 +00:00
Robert Osfield
370deba546 <iterator>, <stdlib.h> and <ctype.h> includes required for QNX compiler 2009-11-17 14:06:07 +00:00
Robert Osfield
79f766efab Added OSG_CPP_EXCEPTIONS_AVAILABLE cmake option to enable optional build of plugins and examples that required C++ exceptions 2009-11-17 12:55:52 +00:00
Robert Osfield
f417706b06 Converted .ive plugin from using C++ exceptions to using a local equivelant, enabling the build on embedded systems. 2009-11-17 12:54:55 +00:00
Robert Osfield
a8abfd64c4 Removed usage of throw 2009-11-17 11:36:32 +00:00
Robert Osfield
817e4818aa Fixed Shader constructor 2009-11-16 17:50:33 +00:00
Robert Osfield
e5bdd460d4 Replaced catch usage 2009-11-16 16:09:50 +00:00
Robert Osfield
95cf62ec01 Removed catch 2009-11-16 15:47:32 +00:00
Robert Osfield
af906310f1 Removed throw. 2009-11-16 15:17:57 +00:00
Robert Osfield
03e95d97f1 Removed throw. 2009-11-16 14:58:31 +00:00
Robert Osfield
d4c58cf1a1 Removed usaged of throw and catch to enable better compatibility with embedded systems that don't support C++ exceptions efficiently. 2009-11-16 14:47:52 +00:00
Robert Osfield
52fbe9723f Added new osg::ShaderBinary class, and support for it in osg::Shader. 2009-11-16 12:32:41 +00:00
Robert Osfield
22e01d3cba From Cedric Pinson, "After fixing Skeleton, i introduce a compile issue in
osganimationhardware example
I added a #include <osg/MatrixTransform> to fix it
"
2009-11-13 13:52:12 +00:00
Robert Osfield
1049f0709b Moved the GLBeginEndAdapter support out of the blocks of the "#if defined(OSG_GL_VERTEX_FUNCS_AVAILABLE) && !defined(OSG_GLES1_AVAILABLE)" guarded blocks.
Fixed the number of components being passed as GLBeginEndAdatper::TexCoord*fv.
2009-11-13 13:42:04 +00:00
Cedric Pinson
5842677662 From Cedric Pinson, Fix Skeleton to compute correctly bind matrix, fix compile issue on osganimationhardware after fixing Skeleton 2009-11-13 13:39:21 +00:00
Robert Osfield
cd2d69506b Added optional finer grained checks for GL errors within Geometry::drawImplementation() to help track down GL errors.
Turned off the vertex attribute aliasing in ArrayDispatchers when the GLBeginEndAdapter is used.
2009-11-13 13:25:59 +00:00
Robert Osfield
b3feedaf0a Added dummy StateSet at top of scene graph when using ShaderGen to copy with subgrahs that contain no StateSet 2009-11-13 12:51:42 +00:00
Robert Osfield
6649f51ff2 From Paul Martz, osgViewer Win32 GL3 context creation support 2009-11-13 10:03:02 +00:00
Robert Osfield
8238396099 Added missing export 2009-11-13 09:56:47 +00:00
Robert Osfield
d508934961 Introduced the usage of GL_MAX_TEXTURE_IMAGE_UNITS where support in place of the check of GL_MAX_TEXTURE_UNITS. 2009-11-12 19:39:50 +00:00
Robert Osfield
8b141567b9 Adapted GLBeginEndAdapter to use state.drawQuad(..) rather than use it's local GL_QUADS emulation.
Fixed to osg::Texture for GLES support.

Added automatic GLenum mode mappings in osg::PrimitiveSet to provide a fallback for non support glDrawArray/glDrawElement modes.

Added finer gained error checking during StateSet::compile().
2009-11-12 14:35:44 +00:00
Robert Osfield
efb9908644 Introdced usage of State::drawQuads 2009-11-12 12:19:09 +00:00
Robert Osfield
4374ca23f9 Introduced new State::drawQuads(..) convinience method to help out with mapping GL 1.x style calls to GLES2.0 compatible calls. 2009-11-12 12:18:33 +00:00
Robert Osfield
20a5820843 Fixed winding of GL_QUADS mapping 2009-11-12 12:14:01 +00:00
Robert Osfield
e166b510c7 Improved compatibility with GLES2 2009-11-12 12:07:13 +00:00
Robert Osfield
95d54ba15c Added glContexVersion, glContextFlags and glContextProfileMask members to osg::GraphicsContext::Traits to support GL3 graphics context creation.
Moved the handling of DisplaySettings into Traits constructor.

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

Added command line and env var support for setting the GLContextVersion, GLContextFlags and GLContextProfileMask to osg::DisplaySettings.
2009-11-11 15:25:42 +00:00
Robert Osfield
05b90497e1 From Paul Martz, enabled packed_depth_stencil support for GL3 2009-11-11 12:04:06 +00:00
Robert Osfield
2983bbe6c3 Merged runtime fix for Win32 OpenGLES build that avoids usage of wglGetProcAddress. 2009-11-11 09:15:03 +00:00
Robert Osfield
14838aafc5 Added OSG_GLES2_FEATURES and OSG_GL3_FEATURES usage where appropriate 2009-11-10 19:16:36 +00:00
Robert Osfield
b199a334d9 Introduced OSG_GL*_FEATURES macros defined in include/GL that are set to 0 or 1 according to what the assocoated version of GL is compiled against.
Removed EXT postfix of FrameBufferObject functions, and added support for checking non EXT versions frame buffer object GL functions.

Introduced usage of OSG_GL*_FEATURES to avoid some #if #else #endif code blocks.

Using a submissions from Paul Martz as a guide added perliminary GL3 support to a range of OSG classes
2009-11-10 17:01:08 +00:00
Robert Osfield
d3ab362eae Removed debug message 2009-11-10 14:59:42 +00:00