Re: [osg-users] [osgPlugins] ffmpeg plugin halting during playback of some videos
Hi all, We ended up with a complete rewrite of the ffmpeg plugin that we've found to provide much more stable and reliable playback compared to the bundled one on the 3.2.x line. The developer hired believed a complete rework was the most expedient path to fix the various issues we encountered. I haven't been following the most recent posts on work on the existing plugin (looks like there has been some), but ours may be worth some review. All the code is licensed under the standard OSG license. https://bitbucket.org/digitalis/osg-ffmpeg-plugin/overview -Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=63298#63298 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [osgPlugins] ffmpeg plugin halting during playback of some videos
As this issue effects a large number of videos and is important functionality for us, we're willing to pay someone for a fix. If interested, please contact j...@digitaliseducation.com. Thanks, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61876#61876 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [osgPlugins] ffmpeg plugin halting during playback of some videos
Hi all, We've been finding some problems with playback of a set of videos. The issue is reproducible using osgMovie but only when --audio is enabled. A particular video will freeze at the same moment on every playback instance (although different videos will freeze in different places). We haven't been able to find a pattern to the bitrates or encoding of videos that fail. All our testing has been using videos on a local drive. In all cases, the videos play fine via 'avplay', which also uses SDL as the audio sink. I'm not familiar with the ffmpeg libs or video/audio decoding in general, but I spent some time debugging the issue. The behavior I'm seeing when the problem reproduces is the video packet buffer becomes full. It appears that as the frame processing loop is spending time trying to insert video frames into a full queue, the audio queue quickly empties and audio begins to stutter. For a reason I wasn't able to determine, this situation degrades further and video packet processing halts with the video queue still full. My intuition was that a race condition is developing so I played around with the timing of threads and locks to no avail. Eventually, I had to move onto other tasks. The only workaround I was able to find was simply increasing both the video and audio packet queue sizes by a couple orders of magnitude. This is certainly not a robust fix though since it likely just hides the problem and pushes it to a later time in a video. I was able to get permission to distribute one of the videos that causes the problem. The audio stuttering reliably begins around 1:05 and video halts a few seconds later (same timing on several machines). It's too large to attach but can be downloaded at http://digitaliseducation.com/random/badblast.mp4. Relevant versions used ... OSG 3.2.1 Ubuntu 14.04 libavcodec.so.54.35.0 libSDL-1.2.so.0.11.4 Cheers, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=61763#61763 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Enabling instancing should automatically disable display lists
If it's messy to automate the behavior, I think even a warning visible at a 'warn' log level would suffice. I.e. pop the message on add/insert PrimitiveSet if the drawarray is instanced and display lists are enabled on the Geometry. If I can squirrel away some time soon, I'll go ahead and submit a fix. -Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58442#58442 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Enabling instancing should automatically disable display lists
Hi all, I found that OSG has display lists enabled by default on Geometry objects and it remains enabled even if instancing is enabled. This made for a fairly long and non-intuitive debug session as I was trying to figure out why my geometry failed to be drawn. Ultimately, I just had to setUseDisplayList( false ). According to the OpenGL spec. The error INVALID_OPERATION is generated if DrawArraysInstanced or DrawElementsInstanced is called during display list compilation, which is what finally clued me in. Wouldn't it makes sense to automatically disable display lists in the case instancing is enabled? Otherwise what is happening is very much hidden under the framework and not in a good way. Cheers, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=58413#58413 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] adding barrel distortion for stereoscopic rendering in Oculus Rift head set
I just got my Rift dev kit today and plan to look at this a bit as well. I'm a little slammed on time for the next week, so I don't have any estimates but I'll post when I have something to show. If anyone else has already made progress, please share ;) Cheers, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54267#54267 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] [3rdparty] osgPango text in world space?
Hi all, I have a wireframe grid defined in 3-space that I want to put some labels on. I was able to get the result I wanted using osgText by using the code below where 'vert' is a world space vertex from the grid. Code: osgText::Text* text = new osgText::Text; text-setFont(font.get()); text-setCharacterSizeMode(osgText::Text::SCREEN_COORDS); text-setCharacterSize( 48.0 ); text-setDrawMode(osgText::Text::TEXT); text-setAxisAlignment(osgText::Text::SCREEN); text-setLayout(osgText::Text::RIGHT_TO_LEFT); text-setText(osgText::String(العربية, osgText::String::ENCODING_UTF8)); text-setPosition( vert ); The only reason I can't stick with osgText is the arabic characters do not render properly (the characters should be connected and they are not). This is a hard requirement for us so I presumably need osgPango. However, osgPango doesn't really seem to have parity with text placement and I wonder if it supports text in world space at all. I've tried the following code and just get extruded garbage on the screen (vert is the same world space coordinate as in the previous snippet). Code: osgPango::TextTransform* t = new osgPango::TextTransform(); t-setMatrix( osg::Matrixd::translate(vert) ); t-addText( span font='DejaVu Sans Mono 14' foreground='#7FFF7F'Testspan,0,0 ); t-finalize(); I have used osgPango in screen space successfully for other purposes. Anyone know if osgPango can work in world coords and if so how? Cheers, Trystan[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=49230#49230 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [3rdparty] Shader Dev Tools
For what platform? A google search will turn up a bunch. Even for the iPad there's GLSL Studio. However, I have yet to find a good open source one that is consistently updated for Linux. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=49232#49232 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [3rdparty] osgPango text in world space?
Figured it out. It was simply a matter of scale. In my world coordinates the default scale of 1.0 for the text was enormous. The fix was just to; t-setScale(0.001, true). -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=49234#49234 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Capture off-screen / Aux buffer in PostDrawCallback?
Thanks for the reply. What I ended up doing was to have a separate FBO (obtained trough native OGL calls) in the PostDrawCallback. Then I bind the texture (same one used in the FBO that performs the render) to this FBO in the callback and was then able to do a glReadBuffer/glReadPixels on the GL_COLOR_ATTACHMENTi buffers successfully via a PBO (although I'm not sure the PBO is really helping in this case). So, this seems to confirm that the FBO I had the texture attached to for the render is indeed released before the callback. It would save a lot of hassle if the one of the DrawCallbacks could be invoked while the render targets for the camera were still intact. But I assume there's some reason for the current behaviour. Anyone venture a guess? Thanks, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=47810#47810 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] slave camera result in a distort result
I don't see a projection matrix being explicitly set. I think OSG does a perspective projection be default. Especially depending on the default FOV, this can produce a pronounced distortion. See the camera methods setProjectionMatrixAsPerspective and setProjectionMatrixAsOrtho. If you want no distortion then you probably want the latter. -Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=47811#47811 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Capture off-screen / Aux buffer in PostDrawCallback?
Hi all, I have a multiple render target setup where a texture is attached to an FBO on GL_COLOR_ATTACHMENT2. The other target is simply the frame buffer on GL_COLOR_ATTACHMENT0. Both targets are the same size and format. A fragment shader uses glFragData[0] and glFragData[2] to write to the targets and I'm getting the expected onscreen data from glFragData[0]. The problem comes in when I try to use a PostDrawCallback to read from GL_COLOR_ATTACHMENT2 so I can move it to an image and manipulate the data on the CPU. In the code below, if I have glReadBuffer(GL_COLOR_ATTACHMENT2) then I get an Warning: detected OpenGL error 'invalid enumerant' at end of SceneView::draw(). glReadBuffer(GL_BACK) works fine but that's not the data I want. Is this because the FBO is already detached when the callback is invoked? Is there another place I can 'hook in' to do this? I've tried simply attaching an osg::image as the secondary render target but I don't need to do this on every frame and it's too big of a performance hit. Callback code: Code: virtual void operator()(osg::RenderInfo renderInfo) const { osg::GraphicsContext* gc = renderInfo.getCurrentCamera()-getGraphicsContext(); osg::GLBufferObject::Extensions* ext = osg::GLBufferObject::getExtensions( gc-getState()-getContextID(),true); int width = gc-getTraits()-width; int height = gc-getTraits()-height; if( m_starMapImage-s() != width || m_starMapImage-t() != height ) { m_starMapImage-allocateImage(width, height, 1, GL_RGBA, GL_UNSIGNED_BYTE); if( m_pbo ) { ext-glDeleteBuffers (1, m_pbo); m_pbo = 0; } } if( !m_pbo ) { ext-glGenBuffers(1, m_pbo); ext-glBindBuffer(GL_PIXEL_PACK_BUFFER, m_pbo); ext-glBufferData(GL_PIXEL_PACK_BUFFER, m_starMapImage- getTotalSizeInBytes(), 0, GL_STREAM_READ); } else ext-glBindBuffer( GL_PIXEL_PACK_BUFFER, m_pbo ); glReadBuffer(GL_COLOR_ATTACHMENT2); glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, 0); GLubyte* src = (GLubyte*)ext-glMapBuffer( GL_PIXEL_PACK_BUFFER, GL_READ_ONLY ); if(src) { memcpy( m_starMapImage-data(), src, m_starMapImage-getTotalSizeInBytes() ); ext-glUnmapBuffer( GL_PIXEL_PACK_BUFFER ); } osgDB::writeImageFile(*m_starMapImage, std::string(test.png)); ext-glBindBuffer( GL_PIXEL_PACK_BUFFER, 0 ); } Camera Setup: Code: osg::TextureRectangle* starMap = new osg::TextureRectangle; starMap-setTextureSize( width, height ); starMap-setInternalFormat( GL_RGBA ); starMap-setSourceFormat( GL_RGBA ); osg::ref_ptrosg::Camera stars3d = new osg::Camera; stars3d-setClearMask( GL_DEPTH_BUFFER_BIT ); stars3d-setGraphicsContext(gc); stars3d-setAllowEventFocus( false ); stars3d-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); stars3d-attach(osg::Camera::COLOR_BUFFER0, renderTarget); stars3d-attach(osg::Camera::COLOR_BUFFER2, starMap); Cheers, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=47793#47793 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Setting camera position
How and when do you want it to change position? You can change position explicitly via the camera manipulator interface; there are a number of different convenience methods for that. If you want the position to change gradually over time (animation) then take a look at the osgGA::AnimationPathManipulator. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=47794#47794 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to create ive and 3ds files
There's a plugin for blender you can use to export content to osg format; https://github.com/cedricpinson/osgexport. Last time I tried it, the support for 2.5 was a little sketchy but it appears to be coming along. Cheers, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=45416#45416 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Saving a Texture3D to an Image
Figured out how to solve the problem in the last post. I just set the texture I want to write on the camera itself so that its active once the post draw is executed. For instance, the code above simply changes to the following. Code: ... camera-getOrCreateStateSet()-setTextureAttributeAndModes(1, outputTexture, osg::StateAttribute::ON); camera-setFinalDrawCallback( new Capture(output.tiff) ); geode-getOrCreateStateSet()-setTextureAttributeAndModes(1, sampler, osg::StateAttribute::ON); geode-getOrCreateStateSet()-addUniform( new osg::Uniform(sampler, 1) ); camera-attach(osg::Camera::COLOR_BUFFER0, outputTexture); geode-getOrCreateStateSet()-setAttributeAndModes( prog, osg::StateAttribute::ON ); viewer.frame(); geode-getOrCreateStateSet()-removeAttribute( prog ); Thanks for pointing me in the right direction. I can get my 3d textures written out now! Thanks, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43854#43854 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Saving a Texture3D to an Image
Hi Robert, Thanks for the reply! That seems to work only if I don't need to set other texture states. For instance, the following fails (2D texture in this case but I need to do similar with 3D). If I comment out the sampler texture attribute, the image is written successfully. With it commented in, image-valid() is false . Code: ... camera-setFinalDrawCallback( new Capture(output.tiff) ); geode-getOrCreateStateSet()-setTextureAttributeAndModes(1, sampler, osg::StateAttribute::ON); geode-getOrCreateStateSet()-addUniform( new osg::Uniform(sampler, 1) ); camera-attach(osg::Camera::COLOR_BUFFER0, outputTexture); geode-getOrCreateStateSet()-setAttributeAndModes( prog, osg::StateAttribute::ON ); viewer.frame(); geode-getOrCreateStateSet()-removeAttribute( prog ); Capture is implemented as follows Code: class Capture : public osg::Camera::DrawCallback { public: Capture( const std::string imagename ) : m_imageName(imagename) {} virtual void operator () (osg::RenderInfo renderInfo) const { osg::ref_ptrosg::Image image = new osg::Image; image-readImageFromCurrentTexture(renderInfo.getContextID(), true); osgDB::writeImageFile(*image, m_imageName); } private: std::string m_imageName; }; So, I'm guessing this approach doesn't work with multiple texture units? Maybe there's a way to force a particular unit active in the callback? Cheers, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43841#43841 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Saving a Texture3D to an Image
Hi, I've been banging my head against how to save a 3D texture out to a dds file for some time now. I've read posts that suggest simply attaching the texture's image to the buffer rather than the texture itself. I've done that for 2D textures with no problem. However, I don't see how that will work in this case; given the setup below. Code: ... camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); camera-setImplicitBufferAttachmentMask(osg::Camera::IMPLICIT_COLOR_BUFFER_ATTACHMENT, osg::Camera::IMPLICIT_COLOR_BUFFER_ATTACHMENT ); camera-attach(osg::Camera::COLOR_BUFFER0, tex1, 0, osg::Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER); camera-attach(osg::Camera::COLOR_BUFFER1, tex2, 0, osg::Camera::FACE_CONTROLLED_BY_GEOMETRY_SHADER); viewer.frame(); ... So, after I render the frame I want to be able to say Code: osgDB::writeImageFile( *tex1-getImage(), foo.dds ) But, of course, this doesn't work since the image isn't updated when the texture changes. Is there a strait forward way to get the texture data back to an image that I'm missing? Thank you! Cheers, Trystan[/code][/list] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=43837#43837 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgPango text always black (even the examples)
Figured it must be something like that. Ok, thanks for the reply! Cheers, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42873#42873 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] osgPango text always black (even the examples)
Just confirming, building against the osg trunk indeed solved the problem for me. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42883#42883 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] osgPango text always black (even the examples)
Hi all, I've used osgPango successfully in the past on a different system, but am facing a strange problem now. All text renders black including in all the out-of-box examples (osgpangoanimation, etc), regardless of what the color is set to in the markup. Anyone else run into this? My system/version info is below. Fedora 15 / Gnome3 with proprietary nvidia drivers (280.13) osg version: 3.0.0 osgPango and osgCairo 1.0.0 tag versions pango 1.28.4 cairo 1.10.2 I've tried updating to the latest versions of osgPango/Cairo as well, no difference. Thank you! Cheers, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=42841#42841 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Building a Texture2D from a PBO?
Well, the crash was indeed caused by not having a valid context. I moved the code into a DrawCallback and it worked but not how I expected. I was hoping that binding a PBO to the state would cause copyTexImage2D to read contents from the PBO. Instead, its just grabbing data from the regular frame buffer / color buffer. It seems like what I'm trying to do shouldn't be so hard. I just need to blit a piece of an image onto a piece of a texture. Doing to by rendering to a texture seems really out of the way. Anyone know of another approach? Thanks, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38745#38745 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Building a Texture2D from a PBO?
Hi all, I'm looking for a way to quickly read parts of images into parts of 2D textures. For instance, given a source rect for an image and a destination rect for the texture I want to get just the source rect into the dest rect with no scaling/resizing etc. I thought I may be able to do something like the snippet below. However, this code crashes on copyTexSubImage. Am I on the right track at all here? img = osgDB::readImageFile(image.png); pbo = new osg::PixelBufferObject(img.get()); texture = new osg::Texture2D; texture-setTextureSize(img-s(), img-t()); state = new osg::State; state-setContextID(viewer.getCamera()-getGraphicsContext()- getState()-getContextID()); state-bindPixelBufferObject(pbo.get()); texture-copyTexSubImage2D(*state, 0, 0, 0, 0, img-s(), img-t()); Thanks in advance, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38722#38722 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Intersection tests on paged PagedLODs
I finally got some time to try this and it's exactly what I needed. Another point I was missing was setting the range on the PagedLODs. I had a bounding vol defined but not the range. Thanks for the tip! -Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38143#38143 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Intersection tests on paged PagedLODs
Hi all, I'm looking for a way to selectively load PagedLODs saved to files on an intersection test. I've built up an Octree represented by a PagedLOD node for each subdivision (similar to the quad-tree example in the 3.0 beginner's guide). Given an arbitrary point or line, I want to be able to test the PagedLODs it intersects with without having unnecessary ones loaded into memory. I gather that intersection visitors will only traverse loaded PagedLODs but won't automatically trigger the database pager to load additional levels (is that correct?). Would I need to create a custom visitor to do this or is there an easier way that I'm missing? Thanks in advance, Trystan -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=37568#37568 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org