Hello all,

I'm trying to migrate my application from GCC to Visual C++ 2005. (...)
The application is QT-based, and use OpenSceneGraph as 3D engine.

It compiles fine, but crashes at launch. I've reproduced it on a small exe 
using one of OSG's example. Here is the code:

Code:

#include <osgViewer/Viewer>
#include <osgGA/TrackballManipulator>
#include <osgDB/ReadFile>

#include <QtCore/QTimer>
#include <QtGui/QKeyEvent>
#include <QtGui/QApplication>
#include <QtOpenGL/QGLWidget>

using Qt::WFlags;

#include <iostream>

class AdapterWidget : public QGLWidget
{
public:

  AdapterWidget( QWidget * parent = 0, const char * name = 0, const QGLWidget * 
shareWidget = 0, WFlags f = 0 );

  virtual ~AdapterWidget() {}

  osgViewer::GraphicsWindow* getGraphicsWindow() { return _gw; }
  const osgViewer::GraphicsWindow* getGraphicsWindow() const { return _gw; }

protected:

  void init();

  QTimer _timer;
  osgViewer::GraphicsWindowEmbedded* _gw;
};

AdapterWidget::AdapterWidget( QWidget * parent, const char * name, const 
QGLWidget * shareWidget, WFlags f):
QGLWidget(parent, shareWidget, f)
{
  connect(&_timer, SIGNAL(timeout()), this, SLOT(updateGL()));
  _timer.start(10);

  _gw = new osgViewer::GraphicsWindowEmbedded(0,0,800,600);
}

class ViewerQT : public AdapterWidget, public osgViewer::Viewer
{
public:

  ViewerQT(QWidget * parent = 0, const char * name = 0, const QGLWidget * 
shareWidget = 0, WFlags f = 0):
        AdapterWidget( parent, name, shareWidget, f )
  {
        getCamera()->setViewport(new osg::Viewport(0,0,width(),height()));
        getCamera()->setGraphicsContext(getGraphicsWindow());
        setThreadingModel(osgViewer::Viewer::SingleThreaded);
  }

  virtual void initializeGL()
  {
        QGLWidget::initializeGL();
  }

  virtual void paintGL()
  {
        frame();
  }

};

int main( int argc, char **argv )
{
  QApplication a( argc, argv );

  ViewerQT* viewerWindow = new ViewerQT();

  viewerWindow->show();
  a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );

  return a.exec();
}




This is the compilation result. I use the pre-compiled libraries but it's the 
same when I recompile it myself.  I statically link against Qt and OSG; 
everything is in release mode.

I got weird Qt warnings (QtOpenGL.lib(qpaintengineex_opengl2.obj) : warning 
LNK4217... ??) , but I have no idea if it's related.


And - finally -, this is the backtrace at execution:


> 
>       ntdll.dll!775d15de()    
>       [Frames below may be incorrect and/or missing, no symbols loaded for 
> ntdll.dll] 
>       ntdll.dll!775d15de()    
>       ntdll.dll!775c014e()    
>       ntdll.dll!775e3cc3()    
>       ntdll.dll!775e3cee()    
>       msvcr90.dll!711769ed()  
>       msvcp90.dll!70654f2a()  
>       msvcp90.dll!70655242()  
>       msvcp90.dll!706559d5()  
>       msvcp90.dll!70656422()  
>       msvcp90.dll!7065642f()  
>       msvcp90.dll!70656458()  
>       msvcp90.dll!70657169()  
>       osg80-osg.dll!566c531f()        
>       msvcr80.dll!74370e30()  
>       ot12-OpenThreads.dll!5f4226b7()         
> >     
> > OsgHelloWorldWIN.exe!osgViewer::GraphicsWindowEmbedded::GraphicsWindowEmbedded(int
> >  x=0, int y=0, int width=800, int height=600)  Line 230 + 0x66 bytes  C++
>       OsgHelloWorldWIN.exe!AdapterWidget::AdapterWidget(QWidget * 
> parent=0x00000000, const char * name=0x00000000, const QGLWidget * 
> shareWidget=0x00000000, QFlags<enum Qt::WindowType> f={...})  Line 43 + 0x2f 
> bytes       C++
>       OsgHelloWorldWIN.exe!ViewerQT::ViewerQT(QWidget * parent=0x00000000, 
> const char * name=0x00000000, const QGLWidget * shareWidget=0x00000000, 
> QFlags<enum Qt::WindowType> f={...})  Line 53 + 0x83 bytes C++
>       OsgHelloWorldWIN.exe!main(int argc=1, char * * argv=0x03651de8)  Line 
> 75 + 0x3e bytes   C++
>       OsgHelloWorldWIN.exe!__tmainCRTStartup()  Line 586 + 0x17 bytes C
>       kernel32.dll!761e33aa()         
>       ntdll.dll!775e9ef2()    
>       ntdll.dll!775e9ec5()    
> 
> 


I tried to active OSG debug, but with no result:


> 
> GraphicsContext::setWindowingSystemInterface() 034D54B8 62833E0C
> GraphicsContext::registerGraphicsContext 0379C2A0
> 


Does anyone have a clue of what the problem might be?

Thank you!

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




Attachments: 
http://forum.openscenegraph.org//files/compilationoutput_149.txt


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

Reply via email to