Re: [osg-users] openscenegraph openGL context error in Qt
gambr wrote: Hi Lokesh, you can find an osgviewerQT example in osg distribution. Anyway I attach an example of a CompositeViewer I'm using for testing that is a little bit different. It uses osgQt. Cheers, Gianni thanks gambr for reply. yeah.. i will give try to your attached osgQt widget example. also, i have solved my problem by deleting layout object and creating whole new layout object and placing QGLWidget into it. Code: removeQMLview(); //destroying QQuikview delete layout(); //deleting Borderlayout with centered QQuikview -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=56978#56978 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] openscenegraph window in qt not showing
Hi, what i'm doing:- i'm creating an OpenSceneGraph based application by integrating openscenegraph scene with QT GUI windowing system. i'm using QML based UI navigation (QML views sits inside a QWidget which in turn sits inside Borderlayout(as center widget) of Parent QWidget(main window)). I'm switching QML UI's with signal slots mechanism, and on particular button selection on QML view(qml signal to c++ QWidget), i'm removing current QML view with QGLWidget which is paintaing OpenSceneGraph by calling osgViewer frame() from paintEvent(QPaintEvent *):- my problem :- getting continues error on console : QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined code(not full) :- osg::Camera* createCamera(int x, int y, int w, int h ) { osg::DisplaySettings* ds = osg::DisplaySettings::instance().get(); osg::ref_ptrosg::GraphicsContext::Traits traits = new osg::GraphicsContext::Traits; traits-windowDecoration = false; traits-x = x; traits-y = y; traits-width = w; traits-height = h; traits-doubleBuffer = true; osg::ref_ptrosg::Camera camera = new osg::Camera; osgQt::initQtWindowingSystem(); QGLFormat format = osgQt::GraphicsWindowQt::traits2qglFormat(traits.get()); osgQt::GLWidget* glwidget = new osgQt::GLWidget(format,0, 0, 0, true); camera-setGraphicsContext(new osgQt::GraphicsWindowQt(glwidget)); camera-setClearColor( osg::Vec4(0.2, 0.2, 0.6, 1.0) ); camera-setViewport( new osg::Viewport(0, 0, traits-width, traits-height) ); camera-setProjectionMatrixAsPerspective(40.0f, static_castdouble(traits-width)/static_castdouble(traits-height), 0.1f, 1000.0f ); return camera.release(); } class GuiMainWindow:public QWidget { Q_OBJECT public: GuiMainWindow() { QDesktopWidget desktop; QRect screen= desktop.screenGeometry(); WIDTH=screen.width(); HIGHT=screen.height(); _camera=createCamera(0,0,WIDTH,HIGHT); _osgroot=new osg::Group; _osgroot-addChild(osgDB::readNodeFile(c:/data/tank.flt)); } virtual void paintEvent(QPaintEvent *) { if(osg_init) _viewer.frame(); } void setOsgScene(osg::Group* root,osg::Camera* camera) { _viewer.setSceneData(root); _viewer.setCamera(camera); _viewer.setCameraManipulator(new osgGA::TrackballManipulator); _viewer.setThreadingModel( osgViewer::Viewer::SingleThreaded); osgQt::GraphicsWindowQt* gw =dynamic_castosgQt::GraphicsWindowQt*(camera-getGraphicsContext()); if(gw) { _layout_center_widget=gw-getGLWidget(); _layout_center_widget=glw; _layout_center_widget-setFocusPolicy(Qt::TabFocus); _base_layout_pane-addWidget(_layout_center_widget, BorderLayout::Center); _base_borderLayout-update(); } connect( _render_timer, SIGNAL(timeout()), this, SLOT(update())); osg_init=true; _render_timer.start(16.66); } void removeQmlView() { qDebug(removing current Qml view..); if(_qml_view) _qml_view-destroy(); } void removeCenterWidget() { if(_layout_center_widget) { qDebug(removing current center_widget..); _base_borderLayout-removeWidget(_layout_center_widget); } } void nextUIFrame(QString str) { if(str.compare(OSG,Qt::CaseInsensitive)==0) { qDebug(OSG Window from QML); removeQmlView(); removeCenterWidget(); setOsgScene(this-_osgroot,this-_camera); return; } if(str.compare(SPLASH,Qt::CaseInsensitive)==0) { Loader* loader=Loader::getInstance(); OSGutil::osgResourceManager* osgResmng=OSGutil::osgResourceManager::getInstance(); removeQmlView(); _qml_view=new QQuickView(); _qml_view-rootContext()-setContextProperty(GuiWindowCpp,this); _qml_view-setSource(QUrl::fromLocalFile(c:/splash.qml); QQuickItem* obj=_qml_view-rootObject(); connect(loader,SIGNAL(feedProgressInfo(QVariant)),obj,SLOT(printCurrentLabel(QVariant))); connect(osgResmng,SIGNAL(feedProgressData(QVariant)),obj,SLOT(printCurrentValue(QVariant))); removeCenterWidget(); _layout_center_widget=QWidget::createWindowContainer(_qml_view,this);
[osg-users] How to apply multiple textures to a model in openscenegraph?
Hi, I have a flt model and multiple *.dds texture files in a Directory :- my folder directory structure:- my_folder |- terrain.flt |- road.dds |- city.dds |- building1.dds |- building2.dds |- building3.dds |- building3.dds |- building4.dds |- building5.dds |- banner1.dds |- banner1.dds I know how to read and apply single .dds texture file to my model (terrain.flt) :- Code: osg::ref_ptrosg::Node terrainModel (osgDB::readNodeFile(c:/my_folder/terrain.flt)); osg::ref_ptrosg::Texture2D tex (new osg::Texture2D); osg::ref_ptrosg::Image image (osgDB::readImageFile(c:/my_folder/road.dds )); tex-setImage(image.get()); osg::ref_ptrosg::StateSet state=terrainModel-getOrCreateStateSet(); state-setTextureAttributeAndModes(0,tex.get(),osg::StateAttribute::ON); but i don't know how to read and apply all these textures to my model (terrain.flt). my attempt :- Code: osg::ref_ptrosg::Node terrainModel (osgDB::readNodeFile(c:/my_folder/terrain.flt)); osg::ref_ptrosg::Texture2DArray texArray (new osg::Texture2DArray); for(int i=0;ifolder_files.size();i++) { osg::ref_ptrosg::Image image (osgDB::readImageFile(c:/my_folder/+file(i))); texArray-setImage(i,image); } osg::ref_ptrosg::StateSet state=terrainModel-getOrCreateStateSet(); state-setTextureAttributeAndModes(0,texArray.get(),osg::StateAttribute::ON); but, it is not working. Help me. Thank you! Cheers, Lokesh -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=54110#54110 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] opengl errors in compiling Openscenegraph 3.1.8 with Qt 5.0.2
Hi, I'm trying to compile openscenegraph-3.1.8 with Qt 5.0.2 using mingw-32 compiler after configuring with cmake 2.8.11 on windows 7 (basic). But, in the compilation process i got the following errors :- Code: In file included from C:/Qt/Qt5.0.2/5.0.2/mingw47_32/include/QtGui/qopengl.h:55:0, from C:/Qt/Qt5.0.2/5.0.2/mingw47_32/include/QtOpenGL/qgl.h:47, from C:/Qt/Qt5.0.2/5.0.2/mingw47_32/include/QtOpenGL/QGLWidget:1, from C:/OpenSceneGraph-3.1.8/include/osgQt/GraphicsWindowQt:24, from C:\OpenSceneGraph-3.1.8\src\osgQt\GraphicsWindowQt.cpp:15: C:/Qt/Qt5.0.2/5.0.2/mingw47_32/include/GLES2/gl2.h:38:26: error: conflicting declaration 'typedef khronos_intptr_t GLintptr' In file included from C:/OpenSceneGraph-3.1.8/include/osg/Array:34:0, from C:/OpenSceneGraph-3.1.8/include/osg/Uniform:23, from C:/OpenSceneGraph-3.1.8/include/osg/StateSet:20, from C:/OpenSceneGraph-3.1.8/include/osg/State:18, from C:/OpenSceneGraph-3.1.8/include/osg/GraphicsContext:17, from C:/OpenSceneGraph-3.1.8/include/osgViewer/GraphicsWindow:17, from C:/OpenSceneGraph-3.1.8/include/osgQt/GraphicsWindowQt:17, from C:\OpenSceneGraph-3.1.8\src\osgQt\GraphicsWindowQt.cpp:15: C:/OpenSceneGraph-3.1.8/include/osg/BufferObject:47:21: error: 'GLintptr' has a previous declaration as 'typedef int GLintptr' In file included from C:/Qt/Qt5.0.2/5.0.2/mingw47_32/include/QtGui/qopengl.h:55:0, from C:/Qt/Qt5.0.2/5.0.2/mingw47_32/include/QtOpenGL/qgl.h:47, from C:/Qt/Qt5.0.2/5.0.2/mingw47_32/include/QtOpenGL/QGLWidget:1, from C:/OpenSceneGraph-3.1.8/include/osgQt/GraphicsWindowQt:24, from C:\OpenSceneGraph-3.1.8\src\osgQt\GraphicsWindowQt.cpp:15: C:/Qt/Qt5.0.2/5.0.2/mingw47_32/include/GLES2/gl2.h:39:26: error: conflicting declaration 'typedef khronos_ssize_t GLsizeiptr' In file included from C:/OpenSceneGraph-3.1.8/include/osg/Array:34:0, from C:/OpenSceneGraph-3.1.8/include/osg/Uniform:23, from C:/OpenSceneGraph-3.1.8/include/osg/StateSet:20, from C:/OpenSceneGraph-3.1.8/include/osg/State:18, from C:/OpenSceneGraph-3.1.8/include/osg/GraphicsContext:17, from C:/OpenSceneGraph-3.1.8/include/osgViewer/GraphicsWindow:17, from C:/OpenSceneGraph-3.1.8/include/osgQt/GraphicsWindowQt:17, from C:\OpenSceneGraph-3.1.8\src\osgQt\GraphicsWindowQt.cpp:15: C:/OpenSceneGraph-3.1.8/include/osg/BufferObject:48:21: error: 'GLsizeiptr' has a previous declaration as 'typedef int GLsizeiptr' I searched google as well google regarding these conflicting declaration errors on google errors, but didn't find anything. Please help me. Thank you! Cheers, Lokesh[/code] -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=55152#55152 Attachments: http://forum.openscenegraph.org//files/compilation_errors_935.txt ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] How to apply textures to a model in openscenegraph?
Hi, I have a flt model and multiple *.dds texture files in a Directory :- my folder contains :- (1) terrain.flt (2) road.dds (3) buildings.dds (4) banners.dds I know how to read and apply single .dds texture file to my model (terrain.flt) :- osg::ref_ptrosg::Node terrainModel (osgDB::readNodeFile (c:/my_folder/terrain.flt)); osg::ref_ptrosg::Texture2D tex (new osg::Texture2D); osg::ref_ptrosg::Image image (osgDB::readImageFile (c:/my_folder/road.dds )); tex-setImage(image.get()); osg::ref_ptrosg::StateSet state=terrainModel-getOrCreateStateSet(); state-setTextureAttributeAndModes(0,tex.get (),osg::StateAttribute::ON); but i don't know how to read and apply all these textures to my model (terrain.flt). Help me. ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to apply textures to a model in openscenegraph?
Robert Osfield robert.osfield@... writes: Hi Lokesh, Your OpenFlight model references all the textures it needs, and if you want to replace or apply new ones you should simply reload the model in Creator or other compatible modelling tool and apply the changes you need then save again. Robert. hi Robert, I have a FLT model which has references to *.tga texture files(with proper UV mapping). i converted these *.tga files into *.dds texture files using Nvidia DDS utility tool (nvdxt.exe). now, i want to load and apply these *.dds texture files to my original FLT model. -Lokesh ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to apply textures to a model in openscenegraph?
Robert Osfield robert.osfield@... writes: Hi Lokesh, The easist thing to do would be to use osgconv to convert the files to native OSG binary format .osgb and have osgconv do the compression for you. Use osgconv --help for the options. The other alternative to to write your own osgDB::Registry::ReadFile callback that intercepts the readImage calls and changes the filename to the .dds equivalent. Robert. Thank you Robert!! I'm interested in your 2nd alternative :- using osgDB::Registry::ReadFile but, i'm Newbie in openscenegraph. can you give a short example. Regards -Lokesh ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] How to apply textures to a model in openscenegraph?
Sergey Kurdakov sergey.forum@... writes: Hi Lokesh in http://www.packtpub.com/openscenegraph-3-0-beginners-guide/book on support tab for the page of the book you may download sample code, in \2824_12_Code\2824_12_Code folder from download zip there is sharing_textures.cpp which has a class class ReadAndShareImageCallback : public osgDB::ReadFileCallback you are looking for as example make something similar, but before loading texture - change extension of loaded image I recommend to get existing osg books and read them - it will save you a lot of time. In India see http://www.junglee.com/mn/search/junglee/ref=nav_sb_noss?url=search-alias%3Dstripbooksfield-keywords=openscenegraph Regards Sergey Thank you Sergey Kurdakov, Openscenegarph 3.0 cookbook seems quite comprehensive. so, i'm going for it. really helpful. -Lokesh ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org