[osg-users] Is it possible to get OpenGL calls as output from OSG?

2012-01-30 Thread Jesper D. Thomsen
Hi guys,

I have what may be a little bit of an unusual question regarding usage of 
OpenSceneGraph.
In our application we use OSG for drawing views of a dynamically created and 
animated model, which has so far worked out very well for us.
We are now in the situation where we would like to be able to interface with 
various CAD packages and be able to show our model inside them. A number of CAD 
packages support this by allowing plugins to render OpenGL calls within the 
host CAD programs viewports (so that the viewport can contain the combined 
contents of the plugin drawing and elements from the host CAD program).
I am wondering if I can somehow use our existing setup for generating these 
OpenGL calls directly from OSG. Would it somehow be possible to draw to a 
kind of OpenGL call buffer rather than directly to a drawing context from 
OpenSceneGraph. I guess that there's no code in OSG which can do this directly, 
but I was thinking that it might be possible to create a substitution for 
GraphicsWindow32 where I could catch the OpenGL calls being generated, and then 
transfer them to a plugin in the CAD program from there.
I do however see some possible issues where OSG is aware of the exact stage of 
the OpenGL setup, and I would somehow have to flush this when generating the 
OpenGL call stack.

Regards, and thanks in advance.

Jesper D. Thomsen
AnyBody Technology
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Is it possible to get OpenGL calls as output from OSG?

2012-01-30 Thread Tim Moore
On Mon, Jan 30, 2012 at 2:48 PM, Jesper D. Thomsen j...@anybodytech.com wrote:
 Hi guys,



 I have what may be a little bit of an unusual question regarding usage of
 OpenSceneGraph.
 In our application we use OSG for drawing views of a dynamically created and
 animated model, which has so far worked out very well for us.

 We are now in the situation where we would like to be able to interface with
 various CAD packages and be able to show our model inside them. A number of
 CAD packages support this by allowing plugins to render OpenGL calls within
 the host CAD programs viewports (so that the viewport can contain the
 combined contents of the plugin drawing and elements from the host CAD
 program).

 I am wondering if I can somehow use our existing setup for generating these
 OpenGL calls directly from OSG. Would it somehow be possible to “draw” to a

 kind of OpenGL call buffer rather than directly to a drawing context from
 OpenSceneGraph. I guess that there’s no code in OSG which can do this
 directly, but I was thinking that it might be possible to create a
 substitution for GraphicsWindow32 where I could catch the OpenGL calls being
 generated, and then transfer them to a plugin in the CAD program from there.
OSG makes OpenGL calls ;-) The issue is running OSG in a situation
where it is not in control of creating and managing the graphics
context. To get started, take a look at the examples like osgviewerSDL
that set up the viewer as an embedded window.

 I do however see some possible issues where OSG is aware of the exact stage
 of the OpenGL setup, and I would somehow have to flush this when generating
 the OpenGL call stack.
Yes, that is the issue. It can be done with some careful use of
callbacks in the scene graph. In your situation, you need to be
careful to be in the expected state when OSG rendering starts, and
leave it in the state expected by the CAD program when OSG finishes
up.

Tim



 Regards, and thanks in advance.



 Jesper D. Thomsen

 AnyBody Technology


 ___
 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] Is it possible to get OpenGL calls as output from OSG?

2012-01-30 Thread Sergey Kurdakov
Hi

it is possible to achieve this in following way:

render to FBO camera on provided by CAD context ( set main camera as FBO ),
get texture ( there are ways to make it clean, but I just stole texture id
from within inside OSG ) and apply it onto OpenGL quad
I achieved rendering in Blender with OSG, but so that it worked I used only
one threaded model.

Regards
Sergey
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Is it possible to get OpenGL calls as output from OSG?

2012-01-30 Thread Chris 'Xenon' Hanson
On 1/30/2012 7:49 AM, Sergey Kurdakov wrote:
 render to FBO camera on provided by CAD context ( set main camera as FBO ), 
 get texture (
 there are ways to make it clean, but I just stole texture id from within 
 inside OSG ) and
 apply it onto OpenGL quad
 I achieved rendering in Blender with OSG, but so that it worked I used only 
 one threaded
 model.

  I've done this too, only using a context cloned and shared from the original 
one
provided by the host app. Then you just rasterize OSG's texture within the host 
app.

 Regards
 Sergey

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
There is no Truth. There is only Perception. To Perceive is to Exist. - 
Xen
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org