Hi,
As I said, I've looked at osgViewer depth partitition and I've some problems.
I'll give you as much information as possible and I hope you can help me.
First of all, I use OSG with Qt :
Code:
int main( int argc, char **argv )
{
QApplication a( argc, argv );
QWidget gloWgt;
gloWgt.setLayout(new QGridLayout());
3DSceneWidget* viewerWindow = new 3DSceneWidget;
gloWgt.layout()->addWidget(viewerWindow);
viewerWindow->addToScene(cube(9.0));
osg::setNotifyLevel(osg::DEBUG_FP);
viewerWindow->setUpDepthPartition();
viewerWindow->getCameraManipulator()->setCamera(osg::Vec3d(0.0,0.0,20.0),osg::Vec3d(0.0,0.0,8.0),osg::Vec3d(0.0,1.0,0.0));
gloWgt.setMinimumSize(1000, 800);
gloWgt.show();
a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
return a.exec();
}
This main is very simple : some Qt objects, one viewer (3DSceneWidget), simple
scene (a cube) and one camera movement. 3DSceneWidget allows the "connection"
between the osgViewer and Qt.
Code:
class 3DSceneWidget : public osgViewer::Viewer, public QGLWidget
I've a problem with window resizing. Indeed, I've a segmentation fault when I
launch my program. GDB (GNU Debugger) provides the following information :
Code:
(gdb) bt
#0 0x08504662 in osg::Viewport::setViewport (this=0x0, x=0, y=0, width=978,
height=778) at /home/godel//OSG-2.9.12/LNX_gcc3.4/include/osg/Viewport:69
#1 0x08500e18 in 3DSceneWidget::resizeGL (this=0x9311980, width=978,
height=778) at 3DSceneWidget.cxx:186
#2 0x088d106d in QGLWidget::resizeEvent ()
#3 0x08914019 in QWidget::event ()
#4 0x088a466b in QGLWidget::event ()
#5 0x088d651a in QApplicationPrivate::notify_helper ()
#6 0x088d6768 in QApplication::notify ()
#7 0x08ef8822 in QCoreApplication::notifyInternal ()
#8 0x0890e42b in QWidgetPrivate::sendPendingMoveAndResizeEvents ()
#9 0x0891575d in QWidgetPrivate::show_helper ()
#10 0x08915cbc in QWidget::setVisible ()
#11 0x089161f1 in QWidgetPrivate::showChildren ()
#12 0x08915774 in QWidgetPrivate::show_helper ()
#13 0x08915cbc in QWidget::setVisible ()
#14 0x084d7d04 in QWidget::show (this=0xbfffeda0) at
/home/godel//QT-4.4.3/LNX_gcc3.4/include/QtGui/qwidget.h:464
#15 0x084d42cc in main (argc=1, argv=0xbfffee64) at main.cxx:120
So, I've looked at resizeGL :
Code:
void 3DSceneWidget::resizeGL( int width, int height )
{
_gw->getEventQueue()->windowResize(0, 0, width, height );
_gw->resized(0,0,width,height);
getCamera()->getViewport()->setViewport(0.0,0.0,width, height );
int numSlave = getNumSlaves();
for (int i=0; i < numSlave; i++)
{
getSlave(i)._camera->setViewport(0.0,0.0,width, height );
}
}
Indeed,
Code:
line 186 : getCamera()->getViewport()->setViewport(0.0,0.0,width, height );
have no sens. When I've used setUpDepthPartition(),
cameraToPartition->setGraphicsContext(0) and cameraToPartition->setViewport(0)
(line 1801/1802 in view.cpp, osg 2.9.12) do inoperable the main camera.
So, I've comment the line 186 but I've a render problem as if the resizing
doesn't work with slave camera or as if I'm required to use the main camera.
I'm very disappointed because I want to solve my depth problem and I like this
method.
I can give you information yet :
- With this horrible rendering, I've the following message for each frame :
Code:
cull_draw() 0xnumber
Warning: detected OpenGL error 'invalid enumerant' at after RenderBin::draw(..)
end cull_draw() 0xnumber
- I've this following message (by view.cpp)
View::setUpDepthPartitionForCamera(..) Replacing main Camera
I've some questions anyway :
- Why do you not use the main camera for the first element of the partition ?
Can I do this ? Do you think, it will solve my problem ?
- Do you think, slave cameras have a problem with rezising (without main
camera) ?
I hope you can help me, it's very important ;)
Thank you!
Cheers,
Clem
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=38955#38955
Attachments:
http://forum.openscenegraph.org//files/render_196.png
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org