Hi,

I'm using a simple class in order to render an OSG view into a Qt environment 
and I'm having trouble trying to render a simple model.

Here is the constructor of the class I use :


Code:

OSGWidget::OSGWidget(QWidget * parent, const QGLWidget * shareWidget, 
Qt::WindowFlags f):
QGLWidget(parent, shareWidget, f),
root(new osg::Group),
graphicsWindow_(new osgViewer::GraphicsWindowEmbedded(this->x(), this->y(), 
this->width(), this->height())),
viewer_(new osgViewer::CompositeViewer)
{
float aspectRatio = static_cast<float>(this->width()) / 
static_cast<float>(this->height());

osg::Camera * camera = new osg::Camera;
camera->setViewport(0, 0, this->width(), this->height());
camera->setClearColor(osg::Vec4(1.f, 1.f, 1.f, 1.f));
camera->setProjectionMatrixAsPerspective(30.f, aspectRatio, 1.f, 1000.f);
camera->setGraphicsContext(graphicsWindow_);

osgViewer::View * view = new osgViewer::View;
view->setCamera(camera);
view->setSceneData(root.get());
view->addEventHandler(new osgViewer::StatsHandler);
view->setCameraManipulator(new osgGA::TrackballManipulator);

viewer_->addView(view);
viewer_->setThreadingModel(osgViewer::CompositeViewer::SingleThreaded);

osg::Node * node = 
osgDB::readNodeFile("/home/sisyphe/Programs/OpenSceneGraph-Data-3.0.0/cessna.osg");
root->addChild(node);

this->setFocusPolicy(Qt::StrongFocus);
this->setMinimumSize(100, 100);

this->setMouseTracking(true);

QTimer * timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(updateView()));
timer->start(10);
}




All the OSG stuff is done here and you can see in attachment how the cessna 
model is rendered. It looks like if faces were rendered in wrong order. 

I didn't find anyone having similar issue.

Is it related to Qt or something like face culling or normals ?

Thank you![/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61281#61281




Attachments: 
http://forum.openscenegraph.org//files/cessna_245.png


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to