[osg-users] Multiple GraphicsContexts
Is it possible to have a viewer with a RTT camera render with one GraphicsContext, then to use that texture with another viewer and a different GraphicsContext? It works ok if all the cameras use the same GC. What I'm aiming for is to render to texture in a completely offscreen buffer, then use that texture in a different scenegraph with a different GraphicsContext. I'm just in the process of upgrading to the latest SVN, but do we have an estimated release date for 2.2? I've been out of the OSG loop for a while, but I'm really impressed with what's happened over the past 12 months or so. Keep up the good work! -J __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multiple GraphicsContexts
If you wish to reuse texture objects generated by one context then you need to share the various contexts with each other. You can set this via the GraphicsContext::Traits::sharedContext variable. On 9/11/07, John Donovan [EMAIL PROTECTED] wrote: Is it possible to have a viewer with a RTT camera render with one GraphicsContext, then to use that texture with another viewer and a different GraphicsContext? It works ok if all the cameras use the same GC. What I'm aiming for is to render to texture in a completely offscreen buffer, then use that texture in a different scenegraph with a different GraphicsContext. I'm just in the process of upgrading to the latest SVN, but do we have an estimated release date for 2.2? I've been out of the OSG loop for a while, but I'm really impressed with what's happened over the past 12 months or so. Keep up the good work! -J __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ 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] Multiple GraphicsContexts
Robert Osfield wrote: If you wish to reuse texture objects generated by one context then you need to share the various contexts with each other. You can set this via the GraphicsContext::Traits::sharedContext variable. Ah! OK, that makes sense. But I am having problems with it... I have the following: ref_ptrGraphicsContext::Traits traits_rtt = new GraphicsContext::Traits; traits_rtt-x = 500; traits_rtt-y = 880; traits_rtt-width = totalWidth; traits_rtt-height = vpHeight; traits_rtt-windowDecoration = false; traits_rtt-doubleBuffer = true; traits_rtt-sharedContext = 0; ref_ptrGraphicsContext gc_rtt = GraphicsContext::createGraphicsContext(traits_rtt.get()); ref_ptrGraphicsContext::Traits traits_view = new GraphicsContext::Traits; traits_view-x = 500; traits_view-y = 800; traits_view-width = totalWidth; traits_view-height = vpHeight; traits_view-windowDecoration = true; traits_view-doubleBuffer = true; traits_view-sharedContext = gc_rtt.get(); ref_ptrGraphicsContext gc_view = GraphicsContext::createGraphicsContext(traits_view.get()); Then I have a viewer with a camera rendering to a texture, and a viewer rendering a textured quad to a window. But when I call Viewer::frame() on the viewer that renders to the window, I get the following error messages: Windows Error #170: [Screen #0] GraphicsWindowWin32::realizeImplementation() - Unable to share OpenGL context. Reason: The requested resource is in use. Error: [Screen #0] GraphicsWindowWin32::makeCurrentImplementation() - Window not realized; cannot do makeCurrent. Are there any examples I can work off? I've tried a search for sharedContext in the OSG project, but I just get the implementation code, not any example code. Incidentally, I've upgraded to 2.1.9 without a hitch. -J __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multiple GraphicsContexts
Hi John, I can only guess that you first need to realize the window before you can share it. For an example of sharing contexts see src/osg/GraphicsContext.cpp and look for the createCompileContext() code segment. Robert. On 9/11/07, John Donovan [EMAIL PROTECTED] wrote: Robert Osfield wrote: If you wish to reuse texture objects generated by one context then you need to share the various contexts with each other. You can set this via the GraphicsContext::Traits::sharedContext variable. Ah! OK, that makes sense. But I am having problems with it... I have the following: ref_ptrGraphicsContext::Traits traits_rtt = new GraphicsContext::Traits; traits_rtt-x = 500; traits_rtt-y = 880; traits_rtt-width = totalWidth; traits_rtt-height = vpHeight; traits_rtt-windowDecoration = false; traits_rtt-doubleBuffer = true; traits_rtt-sharedContext = 0; ref_ptrGraphicsContext gc_rtt = GraphicsContext::createGraphicsContext(traits_rtt.get()); ref_ptrGraphicsContext::Traits traits_view = new GraphicsContext::Traits; traits_view-x = 500; traits_view-y = 800; traits_view-width = totalWidth; traits_view-height = vpHeight; traits_view-windowDecoration = true; traits_view-doubleBuffer = true; traits_view-sharedContext = gc_rtt.get(); ref_ptrGraphicsContext gc_view = GraphicsContext::createGraphicsContext(traits_view.get()); Then I have a viewer with a camera rendering to a texture, and a viewer rendering a textured quad to a window. But when I call Viewer::frame() on the viewer that renders to the window, I get the following error messages: Windows Error #170: [Screen #0] GraphicsWindowWin32::realizeImplementation() - Unable to share OpenGL context. Reason: The requested resource is in use. Error: [Screen #0] GraphicsWindowWin32::makeCurrentImplementation() - Window not realized; cannot do makeCurrent. Are there any examples I can work off? I've tried a search for sharedContext in the OSG project, but I just get the implementation code, not any example code. Incidentally, I've upgraded to 2.1.9 without a hitch. -J __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ 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] Multiple GraphicsContexts
Robert Osfield wrote: BTW, is there a reason why you aren't just using a single context and a FBO RTT Camera? Not as such. But what I'm playing with is some GPGPU stuff where the results won't necessarily be rendered anywhere. I'm really only using the textured quad to check the results, eventually I'll just be reading them back to the CPU. -J __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Multiple GraphicsContexts
John Donovan wrote: ...results won't necessarily be rendered anywhere. On screen, that is. -J __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org