Hiya,

I was able to display osg content on Qt's Declarative interface
(QtQuick, QML, etc) using the osg::GraphicsWindowEmbedded class. I
followed the examples for the FLTK and GLUT toolkits to get this (sort
of) working. There are a few of things I don't understand, and would
appreciate some clarification on.

* What do the parameters passed to the
osgViewer::GraphicsWindowEmbedded constructor (x,y,w,h) actually do? I
played around with the values and it had no visible effect on my
displayed result

* What does GraphicsWindowEmbedded do behind the scenes? Since you
don't explicitly specify a GraphicsContext for it, does that mean it
uses the OpenGL context of the framework you're embedding it into?

* I noticed that the viewport is rendered onto the window in absolute
coordinates. With QtQuick, when you create an item to display on the
screen, it has a child/parent relationship and coordinates are
relative to the parent. Moving the parent will also move the child as
you'd expect. This doesn't happen with GraphicsWindowEmbedded though,
probably because with QtQuick, all the elements are painted onto one
'canvas' (I think), and GraphicsWindowEmbedded just paints straight
onto that.

* If, instead of having GraphicsWindowEmbedded draw on my screen
whenever I call the viewer's frame() method, is it possible to render
the viewer camera's output to a texture that I could manually draw
onto a quad or something? This way I don't have to specify absolute
coordinates for the viewport like I mentioned above. I already tried
this by rendering to an osg::Image, then painting it on the screen
with Qt, but I have a relatively old computer and
osg::Image->readPixels() takes too much time. My results with the
osgscreencapture example were also pretty terrible (15-16 fps @
640x480).

For anyone else who needs to do something similar, here's some scrap
code you can use to define a QDeclarativeItem that'll show an osg
view.

http://pastie.org/3478592  (header)
http://pastie.org/3478602  (source)


Regards,

Preet
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to