[osg-users] Matrix uniform is no longer getting set in osg 3.2+
Hi all, I've recently upgraded an osgEarth application's underlying osg framework from osg 3.0.1 to 3.2.1 and began to receive a bunch of OpenGL invalid operation errors with one of my shaders. Running through gDEBugger, it turns out that one of my uniforms is no longer getting set, and is always zeroed out. In summary of what I'm doing, I create the uniform in a custom ShadowedScene class like so: Code: //Eye to world matrix for determining distance from object in shader osg::ref_ptrosg::Uniform _eyeToWorldUni = new osg::Uniform(eyeToWorld, osg::Matrix::identity()); _stateset-addUniform(_eyeToWorldUni.get()); Then in this custom class' traverse function, I set the uniform: Code: if(nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if(cv) { _eyeToWorldUni-set(*cv-getModelViewMatrix()); } } In my shader, I then use this uniform to calculate the distance from an object to the vertex. In summary I do the following: Vertex: Code: varying vec4 vertCoords = eyeToWorld * (gl_ModelViewMatrix * gl_Vertex); Fragment: Code: vec3 distV = objectPosition - vertCoords.xyz; float dist = length(distV); All my other uniforms (like objectPosition) are unaffected. There is only a problem with the eyeToWorld uniform. Also note, that I did not have to change any of my code to get it to compile in 3.2.1. I just had to rebuild my application with the new binaries. (Trying to rule out some silly mistake I made in the upgrade process.) Any suggestions or osg changes that could have caused this? Thanks, Kevin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59534#59534 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Matrix uniform is no longer getting set in osg 3.2+
Hi Kevin, Can you see what is the offending OpenGL call is, which causes the error? (Should be piece of cake with GDebugger). Also, I always specify the uniforms in terms of their data type (e.g. float vs. double). If there is a mismatch between double and float, some drivers will not link the shader nor execute it correctly. Cheers Sebastian Hi all, I've recently upgraded an osgEarth application's underlying osg framework from osg 3.0.1 to 3.2.1 and began to receive a bunch of OpenGL invalid operation errors with one of my shaders. Running through gDEBugger, it turns out that one of my uniforms is no longer getting set, and is always zeroed out. In summary of what I'm doing, I create the uniform in a custom ShadowedScene class like so: Code: //Eye to world matrix for determining distance from object in shader osg::ref_ptrosg::Uniform _eyeToWorldUni = new osg::Uniform(eyeToWorld, osg::Matrix::identity()); _stateset-addUniform(_eyeToWorldUni.get()); Then in this custom class' traverse function, I set the uniform: Code: if(nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR) { osgUtil::CullVisitor* cv = dynamic_castosgUtil::CullVisitor*(nv); if(cv) { _eyeToWorldUni-set(*cv-getModelViewMatrix()); } } In my shader, I then use this uniform to calculate the distance from an object to the vertex. In summary I do the following: Vertex: Code: varying vec4 vertCoords = eyeToWorld * (gl_ModelViewMatrix * gl_Vertex); Fragment: Code: vec3 distV = objectPosition - vertCoords.xyz; float dist = length(distV); All my other uniforms (like objectPosition) are unaffected. There is only a problem with the eyeToWorld uniform. Also note, that I did not have to change any of my code to get it to compile in 3.2.1. I just had to rebuild my application with the new binaries. (Trying to rule out some silly mistake I made in the upgrade process.) Any suggestions or osg changes that could have caused this? Thanks, Kevin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59534#59534 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and .NET (C#)
Hi Carsten Thanks a bunch! At least some progress. I had to remove from src/csharp/CMakeLists.txt at ln 121 osgdSPACE to get it generated and now configure is complaining (see the attached log). You are sending these files in the zip file, shell I copy them in the csharp folder? OSG VERSION 3.1.6 Configuring done CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osg.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgAnimation.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgDB.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgFX.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgGA.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgManipulator.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgSim.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgText.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgUtil.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgViewer.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx Generating done On Fri, May 23, 2014 at 9:19 AM, Carsten Scharfe cscha...@dspace.de wrote: Try the ones in the attached zip file _ Carsten Scharfe Software Developer Experiment Software ESIM dSPACE GmbH Rathenaustraße 26 33102 Paderborn Germany Tel.: +49 5251 1638-1920 http://www.dspace.com mailto:cscha...@dspace.de cscha...@dspace.de _ *From:* osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] *On Behalf Of *Trajce Nikolov NICK *Sent:* Wednesday, May 21, 2014 10:11 PM *To:* OpenSceneGraph Users *Subject:* Re: [osg-users] OSG and .NET (C#) Hi Carsten, again on this topic, I decided to not give up on this. I am wondering how you actually build osgswig from the current source available. I have examined the CMakeLists.txt files in the project and all I can say this is available for python, perl and java only, from my little understanding of CMake configuration. In the main CMakeLists.txt line 174 is adding the src folder for the core And this is the src CMakeLists IF (BUILD_OSGPYTHON) ADD_SUBDIRECTORY(python) ENDIF(BUILD_OSGPYTHON) IF (BUILD_OSGPERL) ADD_SUBDIRECTORY(perl) ENDIF(BUILD_OSGPERL) IF (BUILD_OSGJAVA) ADD_SUBDIRECTORY(java) ENDIF(BUILD_OSGJAVA) since I dont build it for any of these I am not surprised I am ending up with empty project Can you share the build setting for CMake? Thanks again Nick On Wed, May 21, 2014 at 3:54 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.com wrote: Thanks Robert, I will give it a try. Actually all I care for now is to see the Viewer into .NET control, do not care to much of the underlying approach - but simplier, better. I had thought C# was going out of fashion with the advent of tablet and phones taking midshare and developer time... Nah, at least not in Macedonia. Here you can not find C++ job, all is .NET, C#, Java .. suddenly Thanks again, Nick On Wed, May 21, 2014 at 3:49 PM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Nick et. al, I had thought C# was going out of fashion with the advent of tablet and phones taking midshare and developer time... If you really need C# integration then perhaps just integrating the top level classes like Viewer would be sufficient. Another possible route you could consider is writing C# integration via the new osgDB::PropertyInterface class that I have written to assist with scripting integration. This class provides mechanisms for interface discovery, property get/setting and method invocation, and uses the new
Re: [osg-users] Angular magnification
Hey Steven, Your magnification is modifying the FOV of the view frustum, and thus is best understood as an angular magnification. This statement: atan(_left /_nearClip) /_magnification takes the left half of your horizontal field of view and scales it by your magnification value. Keep in mind, the actual value of your _magnification variable may not directly correspond to a proper angular magnification value (more detail here: http://en.wikipedia.org/wiki/Magnification#Magnification_as_a_number_.28optical_magnification.29 ). These pages may help too: https://forums.epicgames.com/threads/811228-Avoiding-FOV-for-doing-ZOOM http://en.wikipedia.org/wiki/Perspective_distortion_(photography) Alex -Original Message- From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Steven Powers Sent: Thursday, May 22, 2014 1:22 PM To: osg-users@lists.openscenegraph.org Subject: [osg-users] Angular magnification Currently I am simulating magnification by manipulating the projection matrix like this: Code: left = nearClip * tan(atan(_left /_nearClip)/_magnification); right = nearClip * tan(atan(_right /_nearClip)/_magnification); top= nearClip * tan(atan(_top /_nearClip)/_magnification); bottom = nearClip * tan(atan(_bottom/_nearClip)/_magnification); _camera-setProjectionMatrixAsFrustum(left,right,bottom,top,nearClip,farClip); I've been posed a question as to whether this method of magnification is angular or linear. Does anyone know the answer to this question? Cheers, Steven -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59535#59535 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Matrix uniform is no longer getting set in osg 3.2+
Hi Sebastian, Thanks for the speedy response. SMesserschmidt wrote: Also, I always specify the uniforms in terms of their data type (e.g. float vs. double). If there is a mismatch between double and float, some drivers will not link the shader nor execute it correctly. I took your suggestion and am now explicitly specifying the types for all my uniforms and it is now working. What a silly mistake, although, curious as to how it ever worked. Thanks again, Kevin -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=59541#59541 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OSG and .NET (C#)
Hi Nick, I forgot those. Please copy the missing .i files from the python folder to the csharp folder. They are redirecting to the ones one directory level above (the ones i've sent you). Carsten _ Carsten Scharfe Software Developer Experiment Software ESIM dSPACE GmbH Rathenaustraße 26 33102 Paderborn Germany Tel.: +49 5251 1638-1920 http://www.dspace.com mailto:cscha...@dspace.de _ From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Trajce Nikolov NICK Sent: Friday, May 23, 2014 11:12 AM To: OpenSceneGraph Users Subject: Re: [osg-users] OSG and .NET (C#) Hi Carsten Thanks a bunch! At least some progress. I had to remove from src/csharp/CMakeLists.txt at ln 121 osgdSPACE to get it generated and now configure is complaining (see the attached log). You are sending these files in the zip file, shell I copy them in the csharp folder? OSG VERSION 3.1.6 Configuring done CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osg.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgAnimation.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgDB.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgFX.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgGA.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgManipulator.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgSim.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgText.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgUtil.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx CMake Error in src/csharp/CMakeLists.txt: Cannot find source file: D:/Development/osgswig/src/csharp/osgViewer.i Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp .hxx .in .txx Generating done On Fri, May 23, 2014 at 9:19 AM, Carsten Scharfe cscha...@dspace.demailto:cscha...@dspace.de wrote: Try the ones in the attached zip file _ Carsten Scharfe Software Developer Experiment Software ESIM dSPACE GmbH Rathenaustraße 26 33102 Paderborn Germany Tel.: +49 5251 1638-1920 http://www.dspace.com mailto:cscha...@dspace.de _ From: osg-users [mailto:osg-users-boun...@lists.openscenegraph.orgmailto:osg-users-boun...@lists.openscenegraph.org] On Behalf Of Trajce Nikolov NICK Sent: Wednesday, May 21, 2014 10:11 PM To: OpenSceneGraph Users Subject: Re: [osg-users] OSG and .NET (C#) Hi Carsten, again on this topic, I decided to not give up on this. I am wondering how you actually build osgswig from the current source available. I have examined the CMakeLists.txt files in the project and all I can say this is available for python, perl and java only, from my little understanding of CMake configuration. In the main CMakeLists.txt line 174 is adding the src folder for the core And this is the src CMakeLists IF (BUILD_OSGPYTHON) ADD_SUBDIRECTORY(python) ENDIF(BUILD_OSGPYTHON) IF (BUILD_OSGPERL) ADD_SUBDIRECTORY(perl) ENDIF(BUILD_OSGPERL) IF (BUILD_OSGJAVA) ADD_SUBDIRECTORY(java) ENDIF(BUILD_OSGJAVA) since I dont build it for any of these I am not surprised I am ending up with empty project Can you share the build setting for CMake? Thanks again Nick On Wed, May 21, 2014 at 3:54 PM, Trajce Nikolov NICK trajce.nikolov.n...@gmail.commailto:trajce.nikolov.n...@gmail.com wrote: Thanks Robert, I will give it a try. Actually all I care for now is to see the Viewer into .NET control, do not care to much of the underlying approach - but simplier, better. I had thought C# was going out of fashion with the advent of tablet and phones taking midshare and developer time... Nah, at least not in Macedonia. Here you can not find C++ job, all is .NET, C#, Java .. suddenly Thanks again,
Re: [osg-users] OSG and .NET (C#)
Thanks Carsten a bit closer. What version of OSG you are building osgswig against? I am on 3.1.6 and there are swig errors and some others so swig fails now on parsing. Here is the log 1-- Rebuild All started: Project: ZERO_CHECK, Configuration: Debug Win32 -- 1 Checking Build System 1 CMake does not need to re-run because D:/Development/osgswig/CMakeFiles/generate.stamp is up-to-date. 1 CMake does not need to re-run because D:/Development/osgswig/src/CMakeFiles/generate.stamp is up-to-date. 1 CMake does not need to re-run because D:/Development/osgswig/src/csharp/CMakeFiles/generate.stamp is up-to-date. 2-- Rebuild All started: Project: osg, Configuration: Debug Win32 -- 3-- Rebuild All started: Project: osgViewer, Configuration: Debug Win32 -- 4-- Rebuild All started: Project: osgUtil, Configuration: Debug Win32 -- 5-- Rebuild All started: Project: osgText, Configuration: Debug Win32 -- 2 Building Custom Rule D:/Development/osgswig/src/csharp/CMakeLists.txt 2 CMake does not need to re-run because D:\Development\osgswig\src\csharp\CMakeFiles\generate.stamp is up-to-date. 2 Swig source 4 Building Custom Rule D:/Development/osgswig/src/csharp/CMakeLists.txt 4 CMake does not need to re-run because D:\Development\osgswig\src\csharp\CMakeFiles\generate.stamp is up-to-date. 4 Swig source 3 Building Custom Rule D:/Development/osgswig/src/csharp/CMakeLists.txt 5 Building Custom Rule D:/Development/osgswig/src/csharp/CMakeLists.txt 3 CMake does not need to re-run because D:\Development\osgswig\src\csharp\CMakeFiles\generate.stamp is up-to-date. 5 CMake does not need to re-run because D:\Development\osgswig\src\csharp\CMakeFiles\generate.stamp is up-to-date. 3 Swig source 5 Swig source 3..\osgGA.i(42): error : Unable to find 'osgGA\Event' 6-- Rebuild All started: Project: osgSim, Configuration: Debug Win32 -- 6 Building Custom Rule D:/Development/osgswig/src/csharp/CMakeLists.txt 6 CMake does not need to re-run because D:\Development\osgswig\src\csharp\CMakeFiles\generate.stamp is up-to-date. 6 Swig source 5D:\Development\OpenSceneGraph\include\osg\Referenced(79): warning 314: 'ref' is a C# keyword, renaming to '_ref' 5D:\Development\OpenSceneGraph\include\osg\observer_ptr(118): warning 314: 'lock' is a C# keyword, renaming to '_lock' 5D:\Development\OpenSceneGraph\include\osg\BufferObject(298): error : Syntax error in input(3). 2D:\Development\OpenSceneGraph\include\osg\Referenced(79): warning 314: 'ref' is a C# keyword, renaming to '_ref' 2D:\Development\OpenSceneGraph\include\osg\observer_ptr(118): warning 314: 'lock' is a C# keyword, renaming to '_lock' 4D:\Development\OpenSceneGraph\include\osg\Referenced(79): warning 314: 'ref' is a C# keyword, renaming to '_ref' 4D:\Development\OpenSceneGraph\include\osg\observer_ptr(118): warning 314: 'lock' is a C# keyword, renaming to '_lock' 4D:\Development\OpenSceneGraph\include\osg\BufferObject(298): error : Syntax error in input(3). 2D:\Development\OpenSceneGraph\include\osg\BufferObject(298): error : Syntax error in input(3). 7-- Rebuild All started: Project: osgManipulator, Configuration: Debug Win32 -- 8-- Rebuild All started: Project: osgAnimation, Configuration: Debug Win32 -- 9-- Rebuild All started: Project: osgFX, Configuration: Debug Win32 -- 7 Building Custom Rule D:/Development/osgswig/src/csharp/CMakeLists.txt 9 Building Custom Rule D:/Development/osgswig/src/csharp/CMakeLists.txt 7 CMake does not need to re-run because D:\Development\osgswig\src\csharp\CMakeFiles\generate.stamp is up-to-date. 7 Swig source 8 Building Custom Rule D:/Development/osgswig/src/csharp/CMakeLists.txt 9 CMake does not need to re-run because D:\Development\osgswig\src\csharp\CMakeFiles\generate.stamp is up-to-date. 8 CMake does not need to re-run because D:\Development\osgswig\src\csharp\CMakeFiles\generate.stamp is up-to-date. 8 Swig source 9 Swig source 6D:\Development\OpenSceneGraph\include\osg\Referenced(79): warning 314: 'ref' is a C# keyword, renaming to '_ref' 6D:\Development\OpenSceneGraph\include\osg\observer_ptr(118): warning 314: 'lock' is a C# keyword, renaming to '_lock' 6D:\Development\OpenSceneGraph\include\osg\BufferObject(298): error : Syntax error in input(3). 10-- Rebuild All started: Project: osgDB, Configuration: Debug Win32 -- 10 Building Custom Rule D:/Development/osgswig/src/csharp/CMakeLists.txt 10 CMake does not need to re-run because D:\Development\osgswig\src\csharp\CMakeFiles\generate.stamp is up-to-date. 10 Swig source 7D:\Development\OpenSceneGraph\include\osg\Referenced(79): warning 314: 'ref' is a C# keyword, renaming to '_ref' 7D:\Development\OpenSceneGraph\include\osg\observer_ptr(118): warning 314: 'lock' is a C# keyword, renaming to '_lock' 7D:\Development\OpenSceneGraph\include\osg\BufferObject(298): error : Syntax error in input(3). 9D:\Development\OpenSceneGraph\include\osg\Referenced(79): warning 314: 'ref' is a C# keyword,
Re: [osg-users] OpenScenegGraph-3.2.1 release candidate 3 tagged, please test in prep for 3.2.1 release
Robert Osfield robert.osfi...@gmail.com writes: Hi All, This afternoon I tagged the OSG-3.2 branch to make the 3.2.1-rc3 release. Could users please test out this latest release so we can get a feel for how close we are to tagging the final 3.2.1 release. Let me know on this thread if things work fine on your systems and against your application. Links to downloads on the download page of openscenegraph.org: www.openscenegraph.org/index.php/download-section/stable-releases/159-opensenegraph-3-2-1-release-candidate-3 Builds fine on Debian testing amd64. I had, however, to apply a patch by Anton Khirnov (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739460#12) to get the ffmpeg plugin working, since Debian is starting to ship libav version 10. I have not taken that patch to the submissions, since I think is not backwards compatible. -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenScenegGraph-3.2.1 release candidate 3 tagged, please test in prep for 3.2.1 release
Hi Alberto, Thanks for the testing. Do you know how far back the ffmpeg API used in the build fix for libav10 goes? I've looked at the code changes and they look a bit too intrusive to easily retain backwards compatibility, so we'll either have to ignore this patch for 3.2.1 or adopt it and set a ffmpeg min version. Robert. On 23 May 2014 17:07, Alberto Luaces alua...@udc.es wrote: Robert Osfield robert.osfi...@gmail.com writes: Hi All, This afternoon I tagged the OSG-3.2 branch to make the 3.2.1-rc3 release. Could users please test out this latest release so we can get a feel for how close we are to tagging the final 3.2.1 release. Let me know on this thread if things work fine on your systems and against your application. Links to downloads on the download page of openscenegraph.org: www.openscenegraph.org/index.php/download-section/stable-releases/159-opensenegraph-3-2-1-release-candidate-3 Builds fine on Debian testing amd64. I had, however, to apply a patch by Anton Khirnov (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739460#12) to get the ffmpeg plugin working, since Debian is starting to ship libav version 10. I have not taken that patch to the submissions, since I think is not backwards compatible. -- Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Selecting objects
Hi all! I’m new in OpenSceneGraph. I have big models exported from 3dmax and materials from VRay (about 50 000 objects). I want highlight object on scene when clicking on it. Example with showing bounding box work for me ok but I need to highlight object with, for example, green color and transparency. I modify handle function as: bool PickHandler::handle( const osgGA::GUIEventAdapter ea, osgGA::GUIActionAdapter aa ) { if ( ea.getEventType()!=osgGA::GUIEventAdapter::RELEASE || ea.getButton()!=osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON || !(ea.getModKeyMask()osgGA::GUIEventAdapter::MODKEY_CTRL) ) return false; osgViewer::View* viewer = dynamic_castosgViewer::View*(aa); if (viewer) { osg::ref_ptrosgUtil::LineSegmentIntersector ray = new osgUtil::LineSegmentIntersector( osgUtil::Intersector::WINDOW, ea.getX(), ea.getY() ); osgUtil::IntersectionVisitor iv(ray.get()); iv.setTraversalMask( ~0x1 ); viewer-getCamera()-accept(iv); if (ray-containsIntersections()) { osgUtil::LineSegmentIntersector::Intersection resInt = *(ray-getIntersections().begin()); osg::BoundingBox bb = resInt.drawable-getBound(); osg::Vec3 worldCenter = bb.center() * osg::computeLocalToWorld(resInt.nodePath); m_selectionBox-setMatrix( osg::Matrix::scale(bb.xMax()-bb.xMin(), bb.yMax()-bb.yMin(), bb.zMax()-bb.zMin()) * osg::Matrix::translate(worldCenter) ); /// if (m_SelectedNode){ osg::Material* rev_material = new osg::Material; osg::StateSet* rev_state = m_SelectedNode-getOrCreateStateSet(); rev_state-setMode(GL_BLEND,osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); rev_material-setAlpha(osg::Material::FRONT_AND_BACK, 1); rev_state-setAttributeAndModes(rev_material,osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); osg::BlendFunc* bf = new osg::BlendFunc( osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA ); rev_state-setAttributeAndModes(bf); m_SelectedNode-setStateSet(rev_state); m_SelectedNode=NULL; } osg::NodePath nodePath = resInt.nodePath; osg::Node* node = (nodePath.size()=1)?nodePath[nodePath.size()-1]:0; osg::Group* parent = (nodePath.size()=2)?dynamic_castosg::Group*(nodePath[nodePath.size()-2]):0; if (node) { m_SelectedNode = node; osg::Material* material = new osg::Material; osg::StateSet* state = node-getOrCreateStateSet(); state-setMode(GL_BLEND,osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE); material-setAlpha(osg::Material::FRONT_AND_BACK, 0.6); state-setAttribute(material,osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); osg::BlendFunc* bf = new osg::BlendFunc( osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA ); state-setAttribute(bf); state-setRenderingHint(osg::StateSet::TRANSPARENT_BIN); state-setMode(GL_LIGHTING, osg::StateAttribute::OFF); node-setStateSet(state); } /// } } return false; } When select object I have transparency on it. But when I select another object I see that previous object lost it color and become grey. How I can restore previous state of object material? Regards, Alexey. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Selecting objects
Hi Alexey I guess this is the problem, the material you are setting to the previous selected model. Maybe you record the state before selection and set it back when you select a new node Nick On Fri, May 23, 2014 at 6:51 PM, Alexpux alex...@gmail.com wrote: Hi all! I'm new in OpenSceneGraph. I have big models exported from 3dmax and materials from VRay (about 50 000 objects). I want highlight object on scene when clicking on it. Example with showing bounding box work for me ok but I need to highlight object with, for example, green color and transparency. I modify handle function as: bool PickHandler::handle( const osgGA::GUIEventAdapter ea, osgGA::GUIActionAdapter aa ) { if ( ea.getEventType()!=osgGA::GUIEventAdapter::RELEASE || ea.getButton()!=osgGA::GUIEventAdapter::LEFT_MOUSE_BUTTON || !(ea.getModKeyMask()osgGA::GUIEventAdapter::MODKEY_CTRL) ) return false; osgViewer::View* viewer = dynamic_castosgViewer::View*(aa); if (viewer) { osg::ref_ptrosgUtil::LineSegmentIntersector ray = new osgUtil::LineSegmentIntersector( osgUtil::Intersector::WINDOW, ea.getX(), ea.getY() ); osgUtil::IntersectionVisitor iv(ray.get()); iv.setTraversalMask( ~0x1 ); viewer-getCamera()-accept(iv); if (ray-containsIntersections()) { osgUtil::LineSegmentIntersector::Intersection resInt = *(ray-getIntersections().begin()); osg::BoundingBox bb = resInt.drawable-getBound(); osg::Vec3 worldCenter = bb.center() * osg::computeLocalToWorld(resInt.nodePath); m_selectionBox-setMatrix( osg::Matrix::scale(bb.xMax()-bb.xMin(), bb.yMax()-bb.yMin(), bb.zMax()-bb.zMin()) * osg::Matrix::translate(worldCenter) ); /// if (m_SelectedNode){ osg::Material* rev_material = new osg::Material; osg::StateSet* rev_state = m_SelectedNode-getOrCreateStateSet(); rev_state-setMode(GL_BLEND,osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); rev_material-setAlpha(osg::Material::FRONT_AND_BACK, 1); rev_state-setAttributeAndModes(rev_material,osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); osg::BlendFunc* bf = new osg::BlendFunc( osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA ); rev_state-setAttributeAndModes(bf); m_SelectedNode-setStateSet(rev_state); m_SelectedNode=NULL; } osg::NodePath nodePath = resInt.nodePath; osg::Node* node = (nodePath.size()=1)?nodePath[nodePath.size()-1]:0; osg::Group* parent = (nodePath.size()=2)?dynamic_castosg::Group*(nodePath[nodePath.size()-2]):0; if (node) { m_SelectedNode = node; osg::Material* material = new osg::Material; osg::StateSet* state = node-getOrCreateStateSet(); state-setMode(GL_BLEND,osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE); material-setAlpha(osg::Material::FRONT_AND_BACK, 0.6); state-setAttribute(material,osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE); osg::BlendFunc* bf = new osg::BlendFunc( osg::BlendFunc::SRC_ALPHA, osg::BlendFunc::ONE_MINUS_SRC_ALPHA ); state-setAttribute(bf); state-setRenderingHint(osg::StateSet::TRANSPARENT_BIN); state-setMode(GL_LIGHTING, osg::StateAttribute::OFF); node-setStateSet(state); } /// } } return false; } When select object I have transparency on it. But when I select another object I see that previous object lost it color and become grey. How I can restore previous state of object material? Regards, Alexey. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org -- trajce nikolov nick ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Old Developer releases
I see that most of the older developer releases are located at http://trac.openscenegraph.org/downloads/developer_releases/, but the OpenSceneGraph-2.8.5.zip is not located there. Is this an oversight? It would be really nice if that were put back up there. Eric ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Question on CullVisitor::getRenderStage()
Hi Robert (and all) -- I want to get the view matrix, projection matrix, and viewport from the current slave Camera in a multi-display environment, and I want to get them from a cull callback (which could be buried beneath a HUD Camera or post-render processing Camera). I think this is what I want to call: CullVisitor::getRenderStage(); I can see from the code that it returns the root RenderStage. But what exactly is that? Is it the RenderStage associated with the slave Camera? Or with the top-level osgViewer::Viewer's master Camera that drives the slaves? Thanks for any info. -- -Paul ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org