Commit Graph

3087 Commits

Author SHA1 Message Date
Robert Osfield
e9c406a303 Fixed spacing 2009-11-19 16:53:29 +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
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
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
2191e6a48d Moved the set of include/osg/Version into Cmake 2009-11-18 16:24:01 +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
4262d10217 Added osg::ShaderBinary::readShaderBinaryFile(..) static method 2009-11-18 11:25:28 +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
52fbe9723f Added new osg::ShaderBinary class, and support for it in osg::Shader. 2009-11-16 12:32:41 +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
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
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
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
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
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
d0b021568e Added support for mapping GL_QUADS, GL_QUAD_STRIP and GL_POLYGONS to GL_TRIANGLE equivalents. 2009-11-10 11:36:07 +00:00
Robert Osfield
d7d6d2b215 Moved glColor/glNormal definitions for GLES1.x from include/osg/GL to src/osg/ArrayDispatchers.cpp to avoid import/export issues on functions.
Fixed typo of GLES1 in disabling the build of OpenGL1.x/2.x specific examples
2009-11-04 17:26:59 +00:00
Robert Osfield
72ff1f40f9 From Paul Martz, changes for compiling against OpenGL 3.x 2009-11-03 16:34:54 +00:00
Robert Osfield
a4639398e8 Fixed compile issue with Image.cpp and osgautocapture.cpp under GLES.
Fixed handling of EGLDisplay in EGL paths of GraphicsWindowX11
2009-11-01 09:04:41 +00:00
Robert Osfield
93d83010f8 Added EGL support into build system for GLES1 + GLES2.
Added EGL support into GraphicsWindowX11.
2009-10-30 15:17:38 +00:00
Cedric Pinson
7e0a6fa68a From Cedric Pinson, Fix warning in osgAnimation, UpdateCallback. Fix bug removing callback in Action. Fix warning Stats 2009-10-29 16:09:07 +00:00
Robert Osfield
d17d7159a1 Ported osgUtil, osgDB, osgGA, NodeKits and plugins to compile against OpenGL ES 1.1 and OpenGL ES 2.0. 2009-10-28 20:31:57 +00:00
Robert Osfield
e720a7a956 Fixed build on OpenGLES-1.1 and OpenGLES-2.0 targets 2009-10-27 18:07:12 +00:00
Cedric Pinson
8454d414a8 From Cedric Pinson, The following commit include:
* Refactore of RigGeometry to support hardware skinning
* Refactore of Timeline to split Action in differents files
* Add example how to use hardware skinning
2009-10-27 15:37:13 +00:00
Robert Osfield
37ee16403a Introduced usage of OSG_GLES*_AVAILABLE macros to headers and .cpp's to enable building against OpenGL ES 1.x and 2.x headers 2009-10-25 11:52:01 +00:00
Cedric Pinson
c837d34692 From Cedric Pinson, Simplify update callback api in osgAnimation, the decision to link is on the manager or user 2009-10-23 20:35:31 +00:00
Robert Osfield
a7cb28b166 Added includes for OpenGL ES1 and ES2. 2009-10-23 16:51:45 +00:00
Robert Osfield
327b67a305 Added CMake support for specifying what OpenGL target and features that the OpenSceneGraph build should use.
Added use of the new Cmake generated #define's for optionally compiling parts of the OpenSceneGraph's OpenGL support for the various OpenGL targets
2009-10-23 13:19:57 +00:00
Robert Osfield
bab4c272d5 Added support for Vec4ubArray colour arrays 2009-10-23 12:22:18 +00:00
Robert Osfield
d88531c099 Added #define for GL_TEXTURE0 as MS gl.h header is still stuck in the nineties.... 2009-10-22 14:40:35 +00:00
Robert Osfield
9b6e25cf62 Fixed typo and updated wrappers 2009-10-22 12:56:41 +00:00
Robert Osfield
0289e5e5a2 From Stephan Huber, compile fix to OSX. 2009-10-22 12:41:48 +00:00
Robert Osfield
b8f7310d50 Removed, now inappropriate, references to glBegin/glEnd. 2009-10-22 12:04:26 +00:00
Robert Osfield
d743412605 From Cedric Pinson, new StateAttributeCallback replacing StateAttribute::Callback 2009-10-22 12:01:06 +00:00
Robert Osfield
2d38e187fd From Cedric Pinson, "Here a patch to be able to clone stateattribute, in order to do that i
moved the StateAttribute::Callback structure to a file
StateAttributeCallback with the same behavior as NodeCallback.
"
2009-10-22 10:33:16 +00:00
Robert Osfield
cdf9c4363b Fixed type of GLBeginEndAdapter::MultiTexCoord*() and VertexAttrib*(), and fixed the internal offsets used in MultiTexCoord so it properly used the mapping texture_unit = target - GL_TEXTURE0 2009-10-22 08:51:51 +00:00
Robert Osfield
9b04a9379b Added Translatef, Scalef, Rotatef methods, and fixed Color4f method. 2009-10-21 16:42:12 +00:00
Robert Osfield
5e6415696f Removed remaining glBegin/glEnd usage 2009-10-21 16:40:45 +00:00
Cedric Pinson
4372ec3cba From Cedric Pinson, this commit contains the following change:
* Change ref_ptr to observer_ptr to avoid cross reference and leak in Skinning
* Set invalidate to true to re run the check visitor in Skeleton
* Shallow copy Sampler in channel copy constructor
* Add accessor in VertexInfluence
* Remove dead code in Timeline.cpp
* Dont force linking in Bone::UpdateBone, the decision is done by the user or the manager
* Add offset in timeline stats to display each manager on the screen
* Add a flag in animation manager base to enable or not automatic link when modifying the manager
2009-10-21 15:45:13 +00:00
Robert Osfield
2785ea4dfb Added support for automatic vertex aliasing to new ArrayDispatchers, and updated wrappers 2009-10-21 14:09:12 +00:00
Robert Osfield
9499b19b43 Moved the ArrayDispatchers management so that osg::State now has a ArrayDispatchers object that any osg::Geometry can reuse,
and optimized the implementation to reduce the CPU overhead.
2009-10-21 11:18:13 +00:00
Robert Osfield
6a56b6e6be Refactored osg::Geometry::drawImplementation(..) to use new osg::ArrayDispatchers that encapsulate the task
of dispatch osg::Array data as OpenGL attributes.
2009-10-20 19:34:24 +00:00
Robert Osfield
eb9ff0a311 Added support for multitexturing and vertex attributes to GLBeginEndAdapter 2009-10-17 19:22:14 +00:00
Robert Osfield
73ae1637c0 Fixed VS warning 2009-10-17 11:14:03 +00:00
Robert Osfield
aefd1513f4 Ported osg::Geometry across to supporting the aliasing of vertex, color and normal etc. calls to Vertex Attributes.
Added support for automatic aliasing of vertex, normal, color etc. arrays to Vertex Attribute equivelants.

Added new osg::GLBeginEndAdapter class for runtime conversion from glBegin/glEnd codes to vertex arrray equivelants.

Added automatic shader source conversion from gl_ to osg_ builtins.
2009-10-16 16:26:27 +00:00
Robert Osfield
9e2567cb88 Made the use of the new projection and modelview matrix uniforms optional 2009-10-11 06:05:19 +00:00
Robert Osfield
f479eb174c From Paul Martz, "A recent change to add the new geometry shader primitive types has broken the build on Windows. On Windows, those types are declared in the header GL2Extensions, but the PrimitiveSet header (which uses those types) fails to include that header, causing compile errors.
Attached is a version of PrimitiveSet that includes GL2Extensions."
2009-10-11 05:52:11 +00:00