Re: [osg-users] dotosg wrappers not thread safe
Hi, Here is code to reproduce crash: code #include osgDB/ReadFile #include OpenThreads/Mutex #include OpenThreads/Thread #include OpenThreads/Condition static OpenThreads::Condition s_cond; static OpenThreads::Mutex s_mtx; class ReadThread : public OpenThreads::Thread { public: ReadThread() {} void run() { { OpenThreads::ScopedLockOpenThreads::Mutex lock(s_mtx); s_cond.wait(s_mtx); } osg::ref_ptrosg::Node node = osgDB::readNodeFile(cow.osg); } }; int main() { ReadThread t1, t2; t1.start(); t2.start(); // OpenThreads::Thread::microSleep(500); { OpenThreads::ScopedLockOpenThreads::Mutex lock(s_mtx); s_cond.broadcast(); } t1.join(); t2.join(); return 0; } /code To reproduce you can use this script: code #!/usr/bin/env bash while(true); do ./test done /code But while testing fix I have new crash at: ntdll!RtlReportCriticalFailure+0x62 ntdll!RtlpReportHeapFailure+0x26 ntdll!RtlpHeapHandleError+0x12 ntdll!RtlpLogHeapFailure+0xa4 ntdll!RtlpAnalyzeHeapFailure+0x3a8 ntdll!RtlpFreeHeap+0x141f ntdll!RtlFreeHeap+0x1a6 kernel32!HeapFree+0xa MSVCR90!free+0x1c MSVCP90!std::basic_stringchar,std::char_traitschar,std::allocatorchar MSVCP90!std::basic_stringchar,std::char_traitschar,std::allocatorchar MSVCP90!std::operator+char,std::char_traitschar,std::allocatorchar osg92_osgDB!osgDB::Registry::createLibraryNameForExtension+0x34b osg92_osgDB!osgDB::Registry::createLibraryNameForFile+0x42 osg92_osgDB!osgDB::Registry::read+0x1608 osg92_osgDB!osgDB::Registry::readImplementation+0x34c osg92_osgDB!osgDB::Registry::readNodeImplementation+0x6a osg92_osgDB!osgDB::Registry::readNode+0xfc osg92_osgDB!osgDB::readNodeFile+0x4e dotosgcrash!ReadThread::run+0x79 code: std::string Registry::createLibraryNameForExtension(const std::string ext) { std::string lowercase_ext; for(std::string::const_iterator sitr=ext.begin(); sitr!=ext.end(); ++sitr) { lowercase_ext.push_back(tolower(*sitr)); } ExtensionAliasMap::iterator itr=_extAliasMap.find(lowercase_ext); if (itr!=_extAliasMap.end() ext != itr-second) return createLibraryNameForExtension(itr-second); #if defined(OSG_JAVA_BUILD) static std::string prepend = std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/java); #else static std::string prepend = std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/); #endif [..] same design: static std::string prepend = std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/); Mikhail. 04.06.2012 13:17, Mikhail I. Izmestev написал: Hi Robert, It is hard to reproduce this problem (as any thread safety problem) in same state as previous. I have another crash with same problem at: ntdll!RtlEnterCriticalSection+0x6 ot12_OpenThreads!OpenThreads::Mutex::lock+0xe osgdb_deprecated_osg!initGLNames+0x66 osgdb_deprecated_osg!StateSet_readLocalData+0x4f osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readObjectOfType+0x9eb osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readObjectOfType+0x28 osgdb_deprecated_osg!Node_readLocalData+0x349 osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readObject+0x8fb osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readNode+0xe1 osgdb_osg!OSGReaderWriter::readNode+0xfe osgdb_osg!OSGReaderWriter::readNode+0x31c osg80_osgDB!osgDB::Registry::ReadNodeFunctor::doRead+0x28 osg80_osgDB!osgDB::Registry::read+0x5e4 osg80_osgDB!osgDB::Registry::readImplementation+0x34c osg80_osgDB!osgDB::Registry::readNodeImplementation+0x6a osg80_osgDB!osgDB::Registry::readNode+0xfc osg80_osgDB!osgDB::readNodeFile+0x4e crashed code: int Mutex::lock() { Win32MutexPrivateData *pd = static_castWin32MutexPrivateData*(_prvData); #ifdef USE_CRITICAL_SECTION // Block until we can take this lock. EnterCriticalSection( (pd-_cs) ); CRASH HERE return 0; [...] pd-_cs == NULL in this case problem at void initGLNames() { static bool first_time = true; if (!first_time) return; static OpenThreads::Mutex s_initGLNames; OpenThreads::ScopedLockOpenThreads::Mutex lock(s_initGLNames); [...] There is lot of other places with same design: AnimationPath.cpp:201: static osg::ref_ptrosg::AnimationPath s_path = new osg::AnimationPath; CoordinateSystemNode.cpp:48: static ref_ptrEllipsoidModel s_ellipsoidModel = new EllipsoidModel; Drawable.cpp:30: static ref_ptrStateSet s_drawstate = new osg::StateSet; Node.cpp:77: static ref_ptrStateSet s_drawstate = new osg::StateSet; Node.cpp:85: static ref_ptrNodeCallback s_nodecallback = new osg::NodeCallback; NodeCallback.cpp:31: static osg::ref_ptrNodeCallback s_nc = new NodeCallback; OccluderNode.cpp:30: static ref_ptrConvexPlanarOccluder s_occluder = new ConvexPlanarOccluder; Sequence.cpp:26:static bool Sequence_matchLoopMode(const char* str, Sequence.cpp:45:static const char* Sequence_getLoopMode(Sequence::LoopMode mode) Sequence.cpp:57:static bool Sequence_matchSeqMode(const char* str, Sequence.cpp:76:static const char*
Re: [osg-users] OpenSceneGraph on the Playbook
Hi You should read gles2 spec if you'll make apps running with it. There are no builtins gl_FrontColor and gl_Color in gles 2. Use your own varyings. Cheers. 05.06.2012, 00:49, Preet prismatic.proj...@gmail.com: Hiya, I managed to compile and deploy a small OSG test application on the Playbook, but have run into some trouble getting it to work correctly. I'm not creating my own context or windowing system; instead I'm using osg's GraphicsWindowEmbedded with Qt. As a test, I set up a scene with a rotating cube. The application seems to display the viewport (there's the telltale purple-blue background in OSG), but fails to render the cube. The output seems to indicate that creating a shader for the cube fails, but I can't discern any more than that. It feels like this has something to do with OpenGL ES2... I compiled OSG for ES2 based on the instructions I found on the mailing list and the OSG website. I've pasted the output I think is relevant below, with the full output here: (http://pastie.org/4027605), and the OSG scene set up here: (http://pastie.org/4027631). The application works fine and renders as expected using OpenGL on my desktop. Could anyone suggest something to get this working? Preet glVersion=2, isGlslSupported=YES, glslLanguageVersion=1.016 State::convertShaderSourceToOsgBuiltIns() ++Before Converted source void main() { gl_Position = ftransform(); gl_FrontColor = gl_Color; } Converted source uniform mat4 osg_ModelViewProjectionMatrix; attribute vec4 osg_Color; attribute vec4 osg_Vertex; void main() { gl_Position = osg_ModelViewProjectionMatrix * osg_Vertex; gl_FrontColor = osg_Color; } Compiling VERTEX source: 1: uniform mat4 osg_ModelViewProjectionMatrix; 2: attribute vec4 osg_Color; 3: attribute vec4 osg_Vertex; 4: 5: void main() 6: { 7: gl_Position = osg_ModelViewProjectionMatrix * oVERTEX glCompileShader FAILED VERTEX Shader infolog: 0:8(16): error: `gl_FrontColor' undeclared 0:8(16): error: type mismatch FRAGMENT glCompileShader FAILED FRAGMENT Shader infolog: 0:6(19): error: `gl_Color' undeclared 0:6(19): error: Operands to arithmetic operators must be numeric 0:6(19): error: type mismatch glLinkProgram FAILED Program infolog: linking with uncompiled shaderlinking with uncompiled shader ___ 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] dotosg wrappers not thread safe
Hi Robert, I tried to reproduce this problem on linux but without luck. gcc use more complex method of initialization of static variables at function scope. So problem is only with MSVC 2008 (not sure about newer versions). Mikhail. 05.06.2012 10:39, Mikhail I. Izmestev написал: Hi, Here is code to reproduce crash: code #include osgDB/ReadFile #include OpenThreads/Mutex #include OpenThreads/Thread #include OpenThreads/Condition static OpenThreads::Condition s_cond; static OpenThreads::Mutex s_mtx; class ReadThread : public OpenThreads::Thread { public: ReadThread() {} void run() { { OpenThreads::ScopedLockOpenThreads::Mutex lock(s_mtx); s_cond.wait(s_mtx); } osg::ref_ptrosg::Node node = osgDB::readNodeFile(cow.osg); } }; int main() { ReadThread t1, t2; t1.start(); t2.start(); // OpenThreads::Thread::microSleep(500); { OpenThreads::ScopedLockOpenThreads::Mutex lock(s_mtx); s_cond.broadcast(); } t1.join(); t2.join(); return 0; } /code To reproduce you can use this script: code #!/usr/bin/env bash while(true); do ./test done /code But while testing fix I have new crash at: ntdll!RtlReportCriticalFailure+0x62 ntdll!RtlpReportHeapFailure+0x26 ntdll!RtlpHeapHandleError+0x12 ntdll!RtlpLogHeapFailure+0xa4 ntdll!RtlpAnalyzeHeapFailure+0x3a8 ntdll!RtlpFreeHeap+0x141f ntdll!RtlFreeHeap+0x1a6 kernel32!HeapFree+0xa MSVCR90!free+0x1c MSVCP90!std::basic_stringchar,std::char_traitschar,std::allocatorchar MSVCP90!std::basic_stringchar,std::char_traitschar,std::allocatorchar MSVCP90!std::operator+char,std::char_traitschar,std::allocatorchar osg92_osgDB!osgDB::Registry::createLibraryNameForExtension+0x34b osg92_osgDB!osgDB::Registry::createLibraryNameForFile+0x42 osg92_osgDB!osgDB::Registry::read+0x1608 osg92_osgDB!osgDB::Registry::readImplementation+0x34c osg92_osgDB!osgDB::Registry::readNodeImplementation+0x6a osg92_osgDB!osgDB::Registry::readNode+0xfc osg92_osgDB!osgDB::readNodeFile+0x4e dotosgcrash!ReadThread::run+0x79 code: std::string Registry::createLibraryNameForExtension(const std::string ext) { std::string lowercase_ext; for(std::string::const_iterator sitr=ext.begin(); sitr!=ext.end(); ++sitr) { lowercase_ext.push_back(tolower(*sitr)); } ExtensionAliasMap::iterator itr=_extAliasMap.find(lowercase_ext); if (itr!=_extAliasMap.end() ext != itr-second) return createLibraryNameForExtension(itr-second); #if defined(OSG_JAVA_BUILD) static std::string prepend = std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/java); #else static std::string prepend = std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/); #endif [..] same design: static std::string prepend = std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/); Mikhail. 04.06.2012 13:17, Mikhail I. Izmestev написал: Hi Robert, It is hard to reproduce this problem (as any thread safety problem) in same state as previous. I have another crash with same problem at: ntdll!RtlEnterCriticalSection+0x6 ot12_OpenThreads!OpenThreads::Mutex::lock+0xe osgdb_deprecated_osg!initGLNames+0x66 osgdb_deprecated_osg!StateSet_readLocalData+0x4f osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readObjectOfType+0x9eb osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readObjectOfType+0x28 osgdb_deprecated_osg!Node_readLocalData+0x349 osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readObject+0x8fb osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readNode+0xe1 osgdb_osg!OSGReaderWriter::readNode+0xfe osgdb_osg!OSGReaderWriter::readNode+0x31c osg80_osgDB!osgDB::Registry::ReadNodeFunctor::doRead+0x28 osg80_osgDB!osgDB::Registry::read+0x5e4 osg80_osgDB!osgDB::Registry::readImplementation+0x34c osg80_osgDB!osgDB::Registry::readNodeImplementation+0x6a osg80_osgDB!osgDB::Registry::readNode+0xfc osg80_osgDB!osgDB::readNodeFile+0x4e crashed code: int Mutex::lock() { Win32MutexPrivateData *pd = static_castWin32MutexPrivateData*(_prvData); #ifdef USE_CRITICAL_SECTION // Block until we can take this lock. EnterCriticalSection( (pd-_cs) ); CRASH HERE return 0; [...] pd-_cs == NULL in this case problem at void initGLNames() { static bool first_time = true; if (!first_time) return; static OpenThreads::Mutex s_initGLNames; OpenThreads::ScopedLockOpenThreads::Mutex lock(s_initGLNames); [...] There is lot of other places with same design: AnimationPath.cpp:201: static osg::ref_ptrosg::AnimationPath s_path = new osg::AnimationPath; CoordinateSystemNode.cpp:48: static ref_ptrEllipsoidModel s_ellipsoidModel = new EllipsoidModel; Drawable.cpp:30: static ref_ptrStateSet s_drawstate = new osg::StateSet; Node.cpp:77: static ref_ptrStateSet s_drawstate = new osg::StateSet; Node.cpp:85: static ref_ptrNodeCallback s_nodecallback = new osg::NodeCallback; NodeCallback.cpp:31: static osg::ref_ptrNodeCallback s_nc = new NodeCallback; OccluderNode.cpp:30: static ref_ptrConvexPlanarOccluder s_occluder = new ConvexPlanarOccluder; Sequence.cpp:26:static bool Sequence_matchLoopMode(const char* str, Sequence.cpp:45:static const char*
Re: [osg-users] Tessellation
Hi, You original asked for vertices... now you want triangles... is that because you now know how to get the vertices, or is it that you now know what you want more precisely?? I knew how to get the vertex array, but the problem is that I don't know how to get the vertices for each sub-polygon (triangles) generated by the tessellation. Is that you are asking how to get the primitive data from a PrimitiveSet Basically yes. My problem is that I don't really get how the tesselation works and how to create new polygons using the geometry modified by the tessellation. I thought that the tesselation would simply add new PrimitiveSet such as DrawArrays and that I could have created my new polygons using the getFirst() and getCount() function of DrawArrays with my vertexArray. Unfortunately, when I look at my geometry after the tesselation, it only has DrawElementsUByte, and I don't see how I could get a list of triangles from this PrimitiveSet. I've looked at the DOC, the headers and the source but I don't see what to do. Might I also ask you for what purpose you want to know the vertices/primitive data? What are you trying to do with it? For my project, I had to create a class that handles Surfaces (it displays anykind of polygon and it has some useful tools). And I have to implement a tool that triangulate the polygon and create new Surfaces with each triangle ; so instead of trying to implement my own tessellation algo, I thought I would simply use the osg tessellation. I'm really sorry for my lack of precision in my previous posts. And thank you a lot for taking the time to help me. Cheers, Bob -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48043#48043 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Set Viewport background color as transparent
Hi Vishwa, You still don't explain what you mean by a semi-transparent background colour, given what replies you've already had and you've tried it suggest to me that you really are talking about something different as what you are asking really doesn't make sense in an normal graphics application. In a normal graphics application objects can be drawn semi-transparent on top of the background, and multiple Camera's can be layered on top of each one can have the front Camera's disable the clear of the colour buffer so they are rendered on top (see osghud), one can even set the an RGBA colour buffer when doing render to texture as this can be of use when reusing the texture to do appropriate blending. However it really doesn't seem like you are asking to do any of these scenario's, or perhaps you are. The only way I can make sense of what you are asking is that perhaps you might be wanting to render window that is transparent so you can see the desktop below it. Is this correct? Robert. On 5 June 2012 05:01, shekhar vishwa vishwa.shek...@gmail.com wrote: Hi, I want to show the models on semi-transparent backgroud color. I have implemented following code camera1-setViewport( 0, 0, 200, 200 ); camera1-setClearColor( osg::Vec4(0.0f, 1.0f, 1.0f, 0.5f) ); camera1-setRenderOrder( osg::Camera::POST_RENDER ); camera1-setAllowEventFocus( true ); camera1-setClearMask(GL_DEPTH_BUFFER_BIT ); //| GL_DEPTH_BUFFER_BIT camera1-setReferenceFrame( osg::Transform::ABSOLUTE_RF ); But above code is set the background as complete transparent. Please help me to make the camera background as semi-transparent. Thanks Vishwa ___ 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] Tessellation
Hi Bob, The OSG's DrawElements* encapsulate OpenGL's glDrawElements call, so it might be best if you just looked up OpenGL documentation online in books to see how the indices in the DrawElementsUByte/UShort map to triangles. Another alternative to looking at the low level primitives is to use a functor like the TriangleIndexFunctor or TriangleFunctor. Have a search through the OSG code base to see places where this used. Robert. On 5 June 2012 10:50, Bob Slobodan qgalv...@msn.com wrote: Hi, You original asked for vertices... now you want triangles... is that because you now know how to get the vertices, or is it that you now know what you want more precisely?? I knew how to get the vertex array, but the problem is that I don't know how to get the vertices for each sub-polygon (triangles) generated by the tessellation. Is that you are asking how to get the primitive data from a PrimitiveSet Basically yes. My problem is that I don't really get how the tesselation works and how to create new polygons using the geometry modified by the tessellation. I thought that the tesselation would simply add new PrimitiveSet such as DrawArrays and that I could have created my new polygons using the getFirst() and getCount() function of DrawArrays with my vertexArray. Unfortunately, when I look at my geometry after the tesselation, it only has DrawElementsUByte, and I don't see how I could get a list of triangles from this PrimitiveSet. I've looked at the DOC, the headers and the source but I don't see what to do. Might I also ask you for what purpose you want to know the vertices/primitive data? What are you trying to do with it? For my project, I had to create a class that handles Surfaces (it displays anykind of polygon and it has some useful tools). And I have to implement a tool that triangulate the polygon and create new Surfaces with each triangle ; so instead of trying to implement my own tessellation algo, I thought I would simply use the osg tessellation. I'm really sorry for my lack of precision in my previous posts. And thank you a lot for taking the time to help me. Cheers, Bob -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48043#48043 ___ 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] dotosg wrappers not thread safe
Hi, MSVC not support thread safe initialization of static variables at function scope. GCC by default generate thread safe code, but it can generate code like MSVC by passing -fno-threadsafe-statics option. So you can reproduce crash if add -fno-threadsafe-statics option to CXX_FLAGS. Problem will reproduced very easy. Mikhail. 05.06.2012 13:31, Mikhail I. Izmestev написал: Hi Robert, I tried to reproduce this problem on linux but without luck. gcc use more complex method of initialization of static variables at function scope. So problem is only with MSVC 2008 (not sure about newer versions). Mikhail. 05.06.2012 10:39, Mikhail I. Izmestev написал: Hi, Here is code to reproduce crash: code #include osgDB/ReadFile #include OpenThreads/Mutex #include OpenThreads/Thread #include OpenThreads/Condition static OpenThreads::Condition s_cond; static OpenThreads::Mutex s_mtx; class ReadThread : public OpenThreads::Thread { public: ReadThread() {} void run() { { OpenThreads::ScopedLockOpenThreads::Mutex lock(s_mtx); s_cond.wait(s_mtx); } osg::ref_ptrosg::Node node = osgDB::readNodeFile(cow.osg); } }; int main() { ReadThread t1, t2; t1.start(); t2.start(); // OpenThreads::Thread::microSleep(500); { OpenThreads::ScopedLockOpenThreads::Mutex lock(s_mtx); s_cond.broadcast(); } t1.join(); t2.join(); return 0; } /code To reproduce you can use this script: code #!/usr/bin/env bash while(true); do ./test done /code But while testing fix I have new crash at: ntdll!RtlReportCriticalFailure+0x62 ntdll!RtlpReportHeapFailure+0x26 ntdll!RtlpHeapHandleError+0x12 ntdll!RtlpLogHeapFailure+0xa4 ntdll!RtlpAnalyzeHeapFailure+0x3a8 ntdll!RtlpFreeHeap+0x141f ntdll!RtlFreeHeap+0x1a6 kernel32!HeapFree+0xa MSVCR90!free+0x1c MSVCP90!std::basic_stringchar,std::char_traitschar,std::allocatorchar MSVCP90!std::basic_stringchar,std::char_traitschar,std::allocatorchar MSVCP90!std::operator+char,std::char_traitschar,std::allocatorchar osg92_osgDB!osgDB::Registry::createLibraryNameForExtension+0x34b osg92_osgDB!osgDB::Registry::createLibraryNameForFile+0x42 osg92_osgDB!osgDB::Registry::read+0x1608 osg92_osgDB!osgDB::Registry::readImplementation+0x34c osg92_osgDB!osgDB::Registry::readNodeImplementation+0x6a osg92_osgDB!osgDB::Registry::readNode+0xfc osg92_osgDB!osgDB::readNodeFile+0x4e dotosgcrash!ReadThread::run+0x79 code: std::string Registry::createLibraryNameForExtension(const std::string ext) { std::string lowercase_ext; for(std::string::const_iterator sitr=ext.begin(); sitr!=ext.end(); ++sitr) { lowercase_ext.push_back(tolower(*sitr)); } ExtensionAliasMap::iterator itr=_extAliasMap.find(lowercase_ext); if (itr!=_extAliasMap.end() ext != itr-second) return createLibraryNameForExtension(itr-second); #if defined(OSG_JAVA_BUILD) static std::string prepend = std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/java); #else static std::string prepend = std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/); #endif [..] same design: static std::string prepend = std::string(osgPlugins-)+std::string(osgGetVersion())+std::string(/); Mikhail. 04.06.2012 13:17, Mikhail I. Izmestev написал: Hi Robert, It is hard to reproduce this problem (as any thread safety problem) in same state as previous. I have another crash with same problem at: ntdll!RtlEnterCriticalSection+0x6 ot12_OpenThreads!OpenThreads::Mutex::lock+0xe osgdb_deprecated_osg!initGLNames+0x66 osgdb_deprecated_osg!StateSet_readLocalData+0x4f osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readObjectOfType+0x9eb osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readObjectOfType+0x28 osgdb_deprecated_osg!Node_readLocalData+0x349 osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readObject+0x8fb osg80_osgDB!osgDB::DeprecatedDotOsgWrapperManager::readNode+0xe1 osgdb_osg!OSGReaderWriter::readNode+0xfe osgdb_osg!OSGReaderWriter::readNode+0x31c osg80_osgDB!osgDB::Registry::ReadNodeFunctor::doRead+0x28 osg80_osgDB!osgDB::Registry::read+0x5e4 osg80_osgDB!osgDB::Registry::readImplementation+0x34c osg80_osgDB!osgDB::Registry::readNodeImplementation+0x6a osg80_osgDB!osgDB::Registry::readNode+0xfc osg80_osgDB!osgDB::readNodeFile+0x4e crashed code: int Mutex::lock() { Win32MutexPrivateData *pd = static_castWin32MutexPrivateData*(_prvData); #ifdef USE_CRITICAL_SECTION // Block until we can take this lock. EnterCriticalSection( (pd-_cs) ); CRASH HERE return 0; [...] pd-_cs == NULL in this case problem at void initGLNames() { static bool first_time = true; if (!first_time) return; static OpenThreads::Mutex s_initGLNames; OpenThreads::ScopedLockOpenThreads::Mutex lock(s_initGLNames); [...] There is lot of other places with same design: AnimationPath.cpp:201: static osg::ref_ptrosg::AnimationPath s_path = new osg::AnimationPath; CoordinateSystemNode.cpp:48: static ref_ptrEllipsoidModel s_ellipsoidModel = new EllipsoidModel; Drawable.cpp:30: static ref_ptrStateSet s_drawstate = new osg::StateSet; Node.cpp:77: static
[osg-users] [build] Android Compile Errors with 3rd Party library
Hi, First Thank you very much for OSG Android. I am new to Android-ndk. I have a library (QCAR ) for AR. I am trying to use OSG as a render engine for QCAR. So I want to include OSG in QCAR program. I include some of OSG includes in my C++ program. When I compile I am getting error. My Android.mk file looks like this LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) OSG_ANDROID_DIR := /root/Development/Android/vuforia-sdk-android-1-5-9/samples/ImageTargets LIBDIR := $(OSG_ANDROID_DIR)/obj/local/armeabi LOCAL_C_INCLUDES:= $(OSG_ANDROID_DIR)/include LOCAL_CPPFLAGS := -DOSG_LIBRARY_STATIC include $(CLEAR_VARS) LOCAL_MODULE := QCAR-prebuilt LOCAL_SRC_FILES = ../../../build/lib/$(TARGET_ARCH_ABI)/libQCAR.so LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../build/include include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ImageTargets LOCAL_CFLAGS := -Wno-write-strings $(OPENGLES_DEF) LOCAL_LDLIBS := \ -llog $(OPENGLES_LIB) LOCAL_SHARED_LIBRARIES := QCAR-prebuilt LOCAL_SRC_FILES := . include $(BUILD_SHARED_LIBRARY) when I compile (ndk-build) I am getting the following error jni/ImageTargets.cpp:17:31: error: osgDB/DatabasePager: No such file or directory jni/ImageTargets.cpp:18:26: error: osgDB/Registry: No such file or directory jni/ImageTargets.cpp:19:26: error: osgDB/ReadFile: No such file or directory jni/ImageTargets.cpp:20:27: error: osgDB/WriteFile: No such file or directory make: *** [obj/local/armeabi/objs-debug/ImageTargets/ImageTargets.o] Error 1 All these errors with OSG lib. Can you please help me how to compile this? ... Thank you! Cheers, Koduri -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48047#48047 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] [build] Android Compile Errors with 3rd Party library
Hi, In the variable OSG_ANDROID_DIR, you must put the directory path that contains the osg install Thank you! Cheers, Rghima -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48049#48049 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Set Viewport background color as transparent
I thin you can try to set the clear mask alpha channel to a value of 0.5 cheers, John On Jun 4, 2012, at 9:49 PM, shekhar vishwa vishwa.shek...@gmail.com wrote: Hi, Thanks for help. Now I can make the camera background as transparent. What parameters need to set the camera background as semi-transparent. Please help me. Thanks Vishwa ___ 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] [osgPPU] Problems installing osgPPU using cmake 2.8.4
I tried to install the latest osgPPU version I found today, using cmake 2.8.4 and Visual Studio 10, but when i started to configure the folder I got the following cmake-error: Check for working C compiler using: Visual Studio 10 Check for working C compiler using: Visual Studio 10 -- works Detecting C compiler ABI info Detecting C compiler ABI info - done Check for working CXX compiler using: Visual Studio 10 Check for working CXX compiler using: Visual Studio 10 -- works Detecting CXX compiler ABI info Detecting CXX compiler ABI info - done Found OpenGL: opengl32 CUDA installation wasn't found Could not find nvcc, CUDA examples wouldn't be built Could not find cudart library (cudart) Could not find cuda libraries. CMake Warning (dev) at CMakeLists.txt:45 (INCLUDE): Policy CMP0011 is not set: Included scripts do automatic cmake_policy PUSH and POP. Run cmake --help-policy CMP0011 for policy details. Use the cmake_policy command to set the policy and suppress this warning. The included script C:/osgPPU-0.4.0/CMakeModules/cuda/FindCuda.cmake affects policy settings. CMake is implying the NO_POLICY_SCOPE option for compatibility, so the effects are applied to the including context. This warning is for project developers. Use -Wno-dev to suppress it. CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: OPENTHREADS_LIBRARY_RELEASE linked by target osgppu_hdr in directory C:/osgPPU-0.4.0/src/example/hdr linked by target osgppu_viewer in directory C:/osgPPU-0.4.0/src/example/viewer linked by target osgppu_dof in directory C:/osgPPU-0.4.0/src/example/dof linked by target osgppu_cubemap in directory C:/osgPPU-0.4.0/src/example/cubemap linked by target osgppu_texture3D in directory C:/osgPPU-0.4.0/src/example/texture3D linked by target osgppu_video in directory C:/osgPPU-0.4.0/src/example/video linked by target osgppu_ssao in directory C:/osgPPU-0.4.0/src/example/ssao linked by target osgppu_glow in directory C:/osgPPU-0.4.0/src/example/glow linked by target osgPPU in directory C:/osgPPU-0.4.0/src/osgPPU OSGDB_LIBRARY_RELEASE linked by target osgppu_hdr in directory C:/osgPPU-0.4.0/src/example/hdr linked by target osgppu_viewer in directory C:/osgPPU-0.4.0/src/example/viewer linked by target osgppu_dof in directory C:/osgPPU-0.4.0/src/example/dof linked by target osgppu_cubemap in directory C:/osgPPU-0.4.0/src/example/cubemap linked by target osgppu_texture3D in directory C:/osgPPU-0.4.0/src/example/texture3D linked by target osgppu_video in directory C:/osgPPU-0.4.0/src/example/video linked by target osgppu_ssao in directory C:/osgPPU-0.4.0/src/example/ssao linked by target osgppu_glow in directory C:/osgPPU-0.4.0/src/example/glow linked by target osgPPU in directory C:/osgPPU-0.4.0/src/osgPPU OSGGA_LIBRARY_RELEASE linked by target osgppu_hdr in directory C:/osgPPU-0.4.0/src/example/hdr linked by target osgppu_viewer in directory C:/osgPPU-0.4.0/src/example/viewer linked by target osgppu_dof in directory C:/osgPPU-0.4.0/src/example/dof linked by target osgppu_cubemap in directory C:/osgPPU-0.4.0/src/example/cubemap linked by target osgppu_texture3D in directory C:/osgPPU-0.4.0/src/example/texture3D linked by target osgppu_video in directory C:/osgPPU-0.4.0/src/example/video linked by target osgppu_ssao in directory C:/osgPPU-0.4.0/src/example/ssao linked by target osgppu_glow in directory C:/osgPPU-0.4.0/src/example/glow OSGTEXT_LIBRARY_RELEASE linked by target osgppu_hdr in directory C:/osgPPU-0.4.0/src/example/hdr linked by target osgppu_viewer in directory C:/osgPPU-0.4.0/src/example/viewer linked by target osgppu_dof in directory C:/osgPPU-0.4.0/src/example/dof linked by target osgppu_cubemap in directory C:/osgPPU-0.4.0/src/example/cubemap linked by target osgppu_texture3D in directory C:/osgPPU-0.4.0/src/example/texture3D linked by target osgppu_video in directory C:/osgPPU-0.4.0/src/example/video linked by target osgppu_ssao in directory C:/osgPPU-0.4.0/src/example/ssao linked by target osgppu_glow in directory C:/osgPPU-0.4.0/src/example/glow linked by target osgPPU in directory C:/osgPPU-0.4.0/src/osgPPU OSGUTIL_LIBRARY_RELEASE linked by target osgppu_hdr in directory C:/osgPPU-0.4.0/src/example/hdr linked by target osgppu_viewer in directory C:/osgPPU-0.4.0/src/example/viewer linked by target osgppu_dof in directory C:/osgPPU-0.4.0/src/example/dof linked by target osgppu_cubemap in directory C:/osgPPU-0.4.0/src/example/cubemap linked by target osgppu_texture3D in directory C:/osgPPU-0.4.0/src/example/texture3D linked by target osgppu_video in directory
Re: [osg-users] Tessellation
On 06/05/2012 05:50 AM, Bob Slobodan wrote: Basically yes. My problem is that I don't really get how the tesselation works and how to create new polygons using the geometry modified by the tessellation. I thought that the tesselation would simply add new PrimitiveSet such as DrawArrays and that I could have created my new polygons using the getFirst() and getCount() function of DrawArrays with my vertexArray. Unfortunately, when I look at my geometry after the tesselation, it only has DrawElementsUByte, and I don't see how I could get a list of triangles from this PrimitiveSet. I've looked at the DOC, the headers and the source but I don't see what to do. Note that DrawElementsUByte essentially is-a std::vectorGLubyte which stores indices into the vertex attribute arrays. Traverse the vector to get the indices, then look up the specific vertex position, normal, etc, in the appropriate vertex attribute array. --J ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] problem with seams while drawing quads and quad strips
Hi, I am trying to draw a shape that is basically a hollow box with a tick mark on one side extending into the center (screenshot attached). I attempted to do it by drawing QUAD_STRIPS for the outer and inner faces, and QUADS for the top and bottom faces. My problem is, seams are clearly visible on the top of the model where the quads join together. At first I thought I made a mistake with the normal vectors, but I double checked them and I think the math is correct. Is there a better way to accomplish what I am trying to do? Here's the code: Code: osg::Node* drawModel() { osg::Geode *myGeode = new osg::Geode; osg::Geometry *myGeom = new osg::Geometry; myGeode-addDrawable(myGeom); // VERTICES osg::ref_ptrosg::Vec3Array vertices = new osg::Vec3Array; // sides vertices-push_back( osg::Vec3( -1.0, -1.0, 0.0)); vertices-push_back( osg::Vec3( -1.0, -1.0, 0.1)); vertices-push_back( osg::Vec3( 1.0, -1.0, 0.0)); vertices-push_back( osg::Vec3( 1.0, -1.0, 0.1)); vertices-push_back( osg::Vec3( 1.0, 1.0, 0.0)); vertices-push_back( osg::Vec3( 1.0, 1.0, 0.1)); vertices-push_back( osg::Vec3( -1.0, 1.0, 0.0)); vertices-push_back( osg::Vec3( -1.0, 1.0, 0.1)); vertices-push_back( osg::Vec3( -1.0, -1.0, 0.0)); vertices-push_back( osg::Vec3( -1.0, -1.0, 0.1)); // top face vertices-push_back( osg::Vec3( -1.0, -1.0, 0.1)); vertices-push_back( osg::Vec3( -1.0, 1.0, 0.1)); vertices-push_back( osg::Vec3( -0.8, 1.0, 0.1)); vertices-push_back( osg::Vec3( -0.8, -1.0, 0.1)); vertices-push_back( osg::Vec3( -0.8, 0.8, 0.1)); vertices-push_back( osg::Vec3( -0.8, 1.0, 0.1)); vertices-push_back( osg::Vec3( 0.8, 1.0, 0.1)); vertices-push_back( osg::Vec3( 0.8, 0.8, 0.1)); vertices-push_back( osg::Vec3( 0.8, 1.0, 0.1)); vertices-push_back( osg::Vec3( 1.0, 1.0, 0.1)); vertices-push_back( osg::Vec3( 1.0, -1.0, 0.1)); vertices-push_back( osg::Vec3( 0.8, -1.0, 0.1)); vertices-push_back( osg::Vec3( -0.8, -1.0, 0.1)); vertices-push_back( osg::Vec3( -0.8, -0.8, 0.1)); vertices-push_back( osg::Vec3( 0.8, -0.8, 0.1)); vertices-push_back( osg::Vec3( 0.8, -1.0, 0.1)); vertices-push_back( osg::Vec3( -0.1, -0.8, 0.1)); vertices-push_back( osg::Vec3( -0.1, 0.0, 0.1)); vertices-push_back( osg::Vec3( 0.1, 0.0, 0.1)); vertices-push_back( osg::Vec3( 0.1, -0.8, 0.1)); // bottom face vertices-push_back( osg::Vec3( -1.0, -1.0, 0.0)); vertices-push_back( osg::Vec3( -1.0, 1.0, 0.0)); vertices-push_back( osg::Vec3( -0.8, 1.0, 0.0)); vertices-push_back( osg::Vec3( -0.8, -1.0, 0.0)); vertices-push_back( osg::Vec3( -0.8, 0.8, 0.0)); vertices-push_back( osg::Vec3( -0.8, 1.0, 0.0)); vertices-push_back( osg::Vec3( 0.8, 1.0, 0.0)); vertices-push_back( osg::Vec3( 0.8, 0.8, 0.0)); vertices-push_back( osg::Vec3( 0.8, 1.0, 0.0)); vertices-push_back( osg::Vec3( 1.0, 1.0, 0.0)); vertices-push_back( osg::Vec3( 1.0, -1.0, 0.0)); vertices-push_back( osg::Vec3( 0.8, -1.0, 0.0)); vertices-push_back( osg::Vec3( -0.8, -1.0, 0.0)); vertices-push_back( osg::Vec3( -0.8, -0.8, 0.0)); vertices-push_back( osg::Vec3( 0.8, -0.8, 0.0)); vertices-push_back( osg::Vec3( 0.8, -1.0, 0.0)); vertices-push_back( osg::Vec3( -0.1, -0.8, 0.0)); vertices-push_back( osg::Vec3( -0.1, 0.0, 0.0)); vertices-push_back( osg::Vec3( 0.1, 0.0, 0.0)); vertices-push_back( osg::Vec3( 0.1, -0.8, 0.0)); // inner faces vertices-push_back( osg::Vec3( -0.8, -0.8, 0.0)); vertices-push_back( osg::Vec3( -0.8, -0.8, 0.1)); vertices-push_back( osg::Vec3( -0.8, 0.8, 0.0)); vertices-push_back( osg::Vec3( -0.8, 0.8, 0.1)); vertices-push_back( osg::Vec3( 0.8, 0.8, 0.0)); vertices-push_back( osg::Vec3( 0.8, 0.8, 0.1)); vertices-push_back( osg::Vec3( 0.8, -0.8, 0.0)); vertices-push_back( osg::Vec3( 0.8, -0.8, 0.1)); vertices-push_back( osg::Vec3( 0.1, -0.8, 0.0)); vertices-push_back( osg::Vec3( 0.1, -0.8, 0.1)); vertices-push_back( osg::Vec3( 0.1, 0.0, 0.0)); vertices-push_back( osg::Vec3( 0.1, 0.0, 0.1)); vertices-push_back( osg::Vec3( -0.1, 0.0, 0.0)); vertices-push_back( osg::Vec3( -0.1, 0.0, 0.1)); vertices-push_back( osg::Vec3( -0.1, -0.8, 0.0)); vertices-push_back( osg::Vec3( -0.1, -0.8, 0.1)); vertices-push_back( osg::Vec3( -0.8, -0.8, 0.0)); vertices-push_back( osg::Vec3( -0.8, -0.8, 0.1)); myGeom-setVertexArray(vertices); myGeom-addPrimitiveSet(new osg::DrawArrays( osg::PrimitiveSet::QUAD_STRIP, 0, 10 ));
Re: [osg-users] Tessellation
Hi, Another alternative to looking at the low level primitives is to use a functor like the TriangleIndexFunctor or TriangleFunctor. Have a search through the OSG code base to see places where this used. Exactly what I was searching for. Thanks a lot !!! Cheers, Bob -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48053#48053 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph on the Playbook
You either need to write your own GLES2 shader (that's GL2 you have above) or use a shader gen tool that will generate one for you on the fly. Where did the shader, above, come from? -- Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com http://www.alphapixel.com/ Training • Consulting • Contracting 3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 • GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio • LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] problem with seams while drawing quads and quad strips
Hi, Michael Your normals is not correct. With that geometry you should have normals like (0,0,+\-1) for top-bottom, and (0,+\-1,0) with (+\-1,0,0) for sides, i dont get where you got those numbers for normals. Cheers, Sergey. 05.06.2012, 18:09, Michael Schanne michael.scha...@gmail.com: Hi, I am trying to draw a shape that is basically a hollow box with a tick mark on one side extending into the center (screenshot attached). I attempted to do it by drawing QUAD_STRIPS for the outer and inner faces, and QUADS for the top and bottom faces. My problem is, seams are clearly visible on the top of the model where the quads join together. At first I thought I made a mistake with the normal vectors, but I double checked them and I think the math is correct. Is there a better way to accomplish what I am trying to do? Here's the code: Code: osg::Node* drawModel() { osg::Geode *myGeode = new osg::Geode; osg::Geometry *myGeom = new osg::Geometry; myGeode-addDrawable(myGeom); // VERTICES osg::ref_ptrosg::Vec3Array vertices = new osg::Vec3Array; // sides vertices-push_back( osg::Vec3( -1.0, -1.0, 0.0)); vertices-push_back( osg::Vec3( -1.0, -1.0, 0.1)); vertices-push_back( osg::Vec3( 1.0, -1.0, 0.0)); vertices-push_back( osg::Vec3( 1.0, -1.0, 0.1)); vertices-push_back( osg::Vec3( 1.0, 1.0, 0.0)); vertices-push_back( osg::Vec3( 1.0, 1.0, 0.1)); vertices-push_back( osg::Vec3( -1.0, 1.0, 0.0)); vertices-push_back( osg::Vec3( -1.0, 1.0, 0.1)); vertices-push_back( osg::Vec3( -1.0, -1.0, 0.0)); vertices-push_back( osg::Vec3( -1.0, -1.0, 0.1)); // top face vertices-push_back( osg::Vec3( -1.0, -1.0, 0.1)); vertices-push_back( osg::Vec3( -1.0, 1.0, 0.1)); vertices-push_back( osg::Vec3( -0.8, 1.0, 0.1)); vertices-push_back( osg::Vec3( -0.8, -1.0, 0.1)); vertices-push_back( osg::Vec3( -0.8, 0.8, 0.1)); vertices-push_back( osg::Vec3( -0.8, 1.0, 0.1)); vertices-push_back( osg::Vec3( 0.8, 1.0, 0.1)); vertices-push_back( osg::Vec3( 0.8, 0.8, 0.1)); vertices-push_back( osg::Vec3( 0.8, 1.0, 0.1)); vertices-push_back( osg::Vec3( 1.0, 1.0, 0.1)); vertices-push_back( osg::Vec3( 1.0, -1.0, 0.1)); vertices-push_back( osg::Vec3( 0.8, -1.0, 0.1)); vertices-push_back( osg::Vec3( -0.8, -1.0, 0.1)); vertices-push_back( osg::Vec3( -0.8, -0.8, 0.1)); vertices-push_back( osg::Vec3( 0.8, -0.8, 0.1)); vertices-push_back( osg::Vec3( 0.8, -1.0, 0.1)); vertices-push_back( osg::Vec3( -0.1, -0.8, 0.1)); vertices-push_back( osg::Vec3( -0.1, 0.0, 0.1)); vertices-push_back( osg::Vec3( 0.1, 0.0, 0.1)); vertices-push_back( osg::Vec3( 0.1, -0.8, 0.1)); // bottom face vertices-push_back( osg::Vec3( -1.0, -1.0, 0.0)); vertices-push_back( osg::Vec3( -1.0, 1.0, 0.0)); vertices-push_back( osg::Vec3( -0.8, 1.0, 0.0)); vertices-push_back( osg::Vec3( -0.8, -1.0, 0.0)); vertices-push_back( osg::Vec3( -0.8, 0.8, 0.0)); vertices-push_back( osg::Vec3( -0.8, 1.0, 0.0)); vertices-push_back( osg::Vec3( 0.8, 1.0, 0.0)); vertices-push_back( osg::Vec3( 0.8, 0.8, 0.0)); vertices-push_back( osg::Vec3( 0.8, 1.0, 0.0)); vertices-push_back( osg::Vec3( 1.0, 1.0, 0.0)); vertices-push_back( osg::Vec3( 1.0, -1.0, 0.0)); vertices-push_back( osg::Vec3( 0.8, -1.0, 0.0)); vertices-push_back( osg::Vec3( -0.8, -1.0, 0.0)); vertices-push_back( osg::Vec3( -0.8, -0.8, 0.0)); vertices-push_back( osg::Vec3( 0.8, -0.8, 0.0)); vertices-push_back( osg::Vec3( 0.8, -1.0, 0.0)); vertices-push_back( osg::Vec3( -0.1, -0.8, 0.0)); vertices-push_back( osg::Vec3( -0.1, 0.0, 0.0)); vertices-push_back( osg::Vec3( 0.1, 0.0, 0.0)); vertices-push_back( osg::Vec3( 0.1, -0.8, 0.0)); // inner faces vertices-push_back( osg::Vec3( -0.8, -0.8, 0.0)); vertices-push_back( osg::Vec3( -0.8, -0.8, 0.1)); vertices-push_back( osg::Vec3( -0.8, 0.8, 0.0)); vertices-push_back( osg::Vec3( -0.8, 0.8, 0.1)); vertices-push_back( osg::Vec3( 0.8, 0.8, 0.0)); vertices-push_back( osg::Vec3( 0.8, 0.8, 0.1)); vertices-push_back( osg::Vec3( 0.8, -0.8, 0.0)); vertices-push_back( osg::Vec3( 0.8, -0.8, 0.1)); vertices-push_back( osg::Vec3( 0.1, -0.8, 0.0)); vertices-push_back( osg::Vec3( 0.1, -0.8, 0.1)); vertices-push_back( osg::Vec3( 0.1, 0.0, 0.0)); vertices-push_back( osg::Vec3( 0.1, 0.0, 0.1)); vertices-push_back( osg::Vec3( -0.1, 0.0, 0.0)); vertices-push_back( osg::Vec3( -0.1, 0.0,
[osg-users] Rotation Translation problem
Greetings I have a custom camera object that I use to store position and direction in a vec3 and quat and a matrixd which should contain both. Due to the nature of the software I have to interact with using the osg camera is not an option. So, once I have the position and rotation I am supposed to use these values to create the matrixd and then feed that into an osg camera. If I simply use matrixd::setTrans the osg camera ends up in the right place. If I use matrixd::setRotate the osg camera ends up facing the correct direction. If I use both, in either order, the camera ends up in the wrong place. Like a 90 degree rotation about an axis. I'm operating under the assumption that the set function for position is the same as moving an object to world coordinates x,y,z regardless of orientation and set rotation is the same as rotating the object around it's local origin. Please correct me if I'm wrong. So, any ideas as to what I may be doing wrong? Thanks for any help. I also apologize if this is in the wrong thread but I thought this would be the place seeing as how I need advice as to the functions to use. soulsabr -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48058#48058 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] What is the right way to save a FBO texture to disk?
My program has 4 render to texture cameras that get composited into the frame buffer via custom shader. I want to make a screen capture of one of the texture as a response to an event. Attaching an Image to the camera works, but it copies the data to system memory after every frame. Not just when I need it. I tried calling camera-attach(image); viewer-frame(); osgDB::writeImageFile(image); camera-attach(texture); in my event handler, but the image saved was blank. I also tried calling texture-setImage(image), but that image is never updated with fresh data. I also tried calling osg::Image::readPixels() in a Camera::postDrawCallback. This doesn't work because RenderStage detaches the FBO before the callback and I get a screenshot of the framebuffer instead of the texture. Would calling RenderStage::setDisableFboAfterRender(false) fix this? Whats the place to call that function from. Will this screw something up when I try to render to the actual framebuffer? Is there another option I haven't thought of? Perhaps manually attaching the FBO and calling readPixels? Thanks, John -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48059#48059 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Rotation Translation problem
Try invert the matrix before attaching it to the camera. A common mistake is to think about rotating the camera's view instead of rotating the world into the view of the camera. -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48060#48060 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] OpenSceneGraph on the Playbook
On Tue, Jun 5, 2012 at 12:17 PM, Chris Hanson xe...@alphapixel.com wrote: You either need to write your own GLES2 shader (that's GL2 you have above) or use a shader gen tool that will generate one for you on the fly. Where did the shader, above, come from? It was automatically genereated by osg... I didn't explicitly add a shader. Following your (and Sergey's) advice, I tried using the vertex and fragment shaders from the Android OpenGL ES2 example. I don't get any errors from OSG, but I still don't get any output except for an empty viewport. I've made sure my object is in front of the camera, etc. osg output: http://pastie.org/4034304 source (same as above, just using shaders now) http://pastie.org/4034318 Preet ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] zoom to object with camera
Hi all, Hope this is a simple question, in OSG is there a simple way to move the camera so it is viewing the extents of a particular geode in the current scene (e.g. the user selects an object and the camera zooms to it) ? Even better would be is it possible to calculate the new camera position and use the AnimationManipulator to move nicely into position ? Any help would be greatly appreciated. Thanks in advance. Jason ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Set Viewport background color as transparent
I think Vishwa wants to do something similar to what I am currently doing in iOS. I set transparent background in order to see some layer that is below, which in my case is the image coming from the videocamera. Anyway it would be helpful if Vishwa you can explain us better the purpose of your application and the platform where you are running. Cheers, John On Jun 5, 2012, at 12:01 PM, Robert Osfield robert.osfi...@gmail.com wrote: Hi Vishwa, You still don't explain what you mean by a semi-transparent background colour, given what replies you've already had and you've tried it suggest to me that you really are talking about something different as what you are asking really doesn't make sense in an normal graphics application. In a normal graphics application objects can be drawn semi-transparent on top of the background, and multiple Camera's can be layered on top of each one can have the front Camera's disable the clear of the colour buffer so they are rendered on top (see osghud), one can even set the an RGBA colour buffer when doing render to texture as this can be of use when reusing the texture to do appropriate blending. However it really doesn't seem like you are asking to do any of these scenario's, or perhaps you are. The only way I can make sense of what you are asking is that perhaps you might be wanting to render window that is transparent so you can see the desktop below it. Is this correct? Robert. On 5 June 2012 05:01, shekhar vishwa vishwa.shek...@gmail.com wrote: Hi, I want to show the models on semi-transparent backgroud color. I have implemented following code camera1-setViewport( 0, 0, 200, 200 ); camera1-setClearColor( osg::Vec4(0.0f, 1.0f, 1.0f, 0.5f) ); camera1-setRenderOrder( osg::Camera::POST_RENDER ); camera1-setAllowEventFocus( true ); camera1-setClearMask(GL_DEPTH_BUFFER_BIT ); //| GL_DEPTH_BUFFER_BIT camera1-setReferenceFrame( osg::Transform::ABSOLUTE_RF ); But above code is set the background as complete transparent. Please help me to make the camera background as semi-transparent. Thanks Vishwa ___ 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 mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Set Viewport background color as transparent
Hi, I am trying to implement the multiple views in same window. Each view render the diffrent models.User can set the view position at run time by mouse dragging. If dragged view is overlapped with any view then dragged view backgroud should be semi-trasparent. Please suggest me to resolve this. Thanks Vishwa ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] zoom to object with camera
Hi, yes this function is called node tracking. You can track a node and configure which degrees of freedom your camera should provide. There is a default Nodetracker-Manipulator in OSG. You just have to set the Node you want to track. Cheers, Torben -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=48067#48067 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org