Re: [osg-users] Offscreen snapshot.
Thanks for the replay. It doesn't work for me. It seems that there are some side effects: when I add the slave camera the screenshot from the main camera stop to work. I tried also with a composite viewer but... no: it doesn't work. Anyway: thanks fot the suggestion. I'll study more carefully the example. Bye Giulio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=39648#39648 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Offscreen snapshot.
Hi, I removed the manual call to readPixel and now... it works! Thank you very much. Cheers, Giulio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=39656#39656 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Offscreen snapshot.
Hi all, I have a viewer from wihch i take some snapshot. The code is something like this: r_Viewer = new osgViewer::Viewer(); r_Viewer-setSceneData(p_RootNode); p_hWND = reinterpret_castHWND (wnd); osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits(); traits-inheritedWindowData = new osgViewer::GraphicsWindowWin32::WindowData( p_hWND ); [...] // some init stuff [...] osg::ref_ptrosg::GraphicsContext gc = osg::GraphicsContext::createGraphicsContext (traits.get()); osg::ref_ptrosg::Camera camera = r_Viewer-getCamera(); camera-setGraphicsContext (gc.get()); camera-setViewport (...); camera-setProjectionMatrixAsPerspective (...); p_ScreenShot = new osg::Image; camera-attach(osg::Camera::COLOR_BUFFER, p_ScreenShot); [...] r_Viewer-frame(); // Note that i call frame() on demand. [...] p_ScreenShot-readPixels(x, y, width, height, GL_RGBA, GL_UNSIGNED_BYTE); This work fine. The question is: what if i need to take an offscreen screenshot? In particular I need to take a snapshot of the same scene from a different point of view, but without render it. Is this possible? Thank you. Best regards. Giulio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=39594#39594 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Lose view and projection matrix corrupted.
Hi all, in my application I have a couple of strange effects I cannot explain. In a few words: It is a C# application in which a user defined control: class MyControl : UserControl create an osg viewer via C++/CLI: _MyControl_Interop.Init(this.Handle); On the C++ side we have standard stuff: p_hWND = reinterpret_castHWND (wnd); traits-inheritedWindowData = new osgViewer::GraphicsWindowWin32::WindowData(p_hWND); etc, etc. On the C++ side I don't have a rendering loop but I call myViewer-frame() only when needed. The two strange effects are: 1) When the application loses the focus, all the objects and the background layer often disappear and all I see is the clear color (i.e. the color set with MyViewer-getCamera()-setClearColor(...)). Then I need to set the focus on the panel again and do another call to myViewer-frame() to restore the correct view. Is this normal? How can I avoid this? 2) After a few calls to myViewer-frame(), the projection matrix become corrupted (even if I didn't change anything in the scene), and I need to reset it. I read this article: http://chadaustin.me/2009/02/ind-and-qnan-with-fpfast/: is it right? Do I need to recompile osg? (currently I'm using precompiled libraries). Best regards. Giulio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38397#38397 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Fast VectorArray inizialization.
Hi all, I have some code like this: float coordinates[] ... ... an external source fill the previous array ... ... osg::ref_ptrosg::Vec3Array vertices = new osg::Vec3Array(); for (int i = 0; i 3 * numPoints; i += 3) { float x = coordinates[i]; float y = coordinates[i+1]; float z = coordinates[i+2]; vertices-push_back(osg::Vec3(x, y, z)); } modelGeometry-setVertexArray(vertices); I'd rather do something like this: modelGeometry-setVertexArray_FromCArray(coordinates); Is it possible? How? --- Best regards, Giulio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38157#38157 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Fast VectorArray inizialization.
Thanks a lot! This is exactly what I was looking for. Best regards. Giulio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=38162#38162 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Efficient representation of triangulation.
Thanks a lot! Giulio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31973#31973 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] Efficient representation of triangulation.
Hi, in my application I have a numerical module that create 3d objects and their meshing (triangulation). What I would like to do is to render these objects in the fastest possible way. Something like: - write in a raw array the list of the vertex of the triangles - tell to OSG to read (and render) that memory area Is this possible? Where could I find documentation about this? (I searched in the forum, but I didn't find anything useful). Thank you! Cheers, Giulio -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=31944#31944 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org