OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

How to get the listof supported file formats


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
danielperaza
Newbie


Joined: 28 Jun 2011
Posts: 16

PostPosted: Tue Jun 28, 2011 10:47 pm    Post subject:
How to get the listof supported file formats
Reply with quote

Hi, I'm using OSG & Qt to build a visualizer for my thesis. I'm completely new to OSG and almost as new to Computer Graphics Programming too, so please don't mad on me and be patient Wink

I need to know how to get the list of supported file formats in order to use QFileDialog with the proper extension filters. I'm trying this in a slot of my main window:

Code:

void MainWindow::loadFile()
{
    osg::ref_ptr<osgDB::Registry> registry = osgDB::Registry::instance();
    osgDB::Registry::ReaderWriterList readers = registry->getReaderWriterList();
    osgDB::Registry::ReaderWriterList::iterator it;
    osgDB::ReaderWriter::FormatDescriptionMap descrMap;
    osgDB::ReaderWriter::FormatDescriptionMap::iterator descrMapIt;


    qDebug() << readers.size() << " registered ReaderWriters";

    for (it = readers.begin(); it != readers.end(); it++) {
        descrMap = (*it)->supportedOptions();

        for( descrMapIt = descrMap.begin(); descrMapIt != descrMap.end(); descrMapIt++) {
            //std::cout << (*descrMapIt);
        }
    }


    QString filename = QFileDialog::getOpenFileName(
                            this, tr("Load a File:"),
                            QDir::homePath(), "OpenSceneGraph (*.osg)"
                        );

    if ( !filename.isNull() ) {
        this->osgWidget->loadModel(filename);
    }
}


But qDebug() always says that there are no registered ReaderWriters. I'd expect to get the native osg ReaderWriter as a minimum, but I can't get that even.


Thank you!

Cheers,
Daniel Very Happy Very Happy Confused Sad Sad [/code]
Back to top
View user's profile Send private message
Ulrich Hertlein
Guest





PostPosted: Wed Jun 29, 2011 7:21 am    Post subject:
How to get the listof supported file formats
Reply with quote

Hi Daniel,

On 29/06/11 0:47 , Daniel Peraza wrote:
Quote:
Hi, I'm using OSG & Qt to build a visualizer for my thesis. I'm completely new to OSG
and almost as new to Computer Graphics Programming too, so please don't mad on me and be
patient ;-)

I need to know how to get the list of supported file formats in order to use
QFileDialog with the proper extension filters. I'm trying this in a slot of my main window:
...

But qDebug() always says that there are no registered ReaderWriters. I'd expect to get
the native osg ReaderWriter as a minimum, but I can't get that even.

ReaderWriters are registered as they are used, i.e. when you load a file that requires a
specific reader/writer. So if you haven't actually loaded anything yet that list is
empty, after loading say an .obj file it will contain the ReaderWriterOBJ.

Have a look at applications/osgconv/osgconv.cpp. It supports listing all available
plugins via 'osgconv --formats' and uses osgDB::listAllAvailablePlugins() to do that.

HTH,
/ulrich


------------------
Post generated by Mail2Forum
Back to top
danielperaza
Newbie


Joined: 28 Jun 2011
Posts: 16

PostPosted: Wed Jun 29, 2011 10:15 pm    Post subject:
Thank U
Reply with quote

I thought that ReaderWriters were registered at startup. If you had not told me, I'd never noticed because documentation about it's very reduced.
Back to top
View user's profile Send private message
danielperaza
Newbie


Joined: 28 Jun 2011
Posts: 16

PostPosted: Thu Jun 30, 2011 12:51 am    Post subject:
A last hint
Reply with quote

Please give me one last hint.

I have taken a look to to osgconv.cpp as you told me and I found this:

Code:

if (arguments.read("--formats")
    {
        osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins();
        for(osgDB::FileNameList::iterator itr = plugins.begin();
            itr != plugins.end();
            ++itr)
        {
            osgDB::outputPluginDetails(std::cout,*itr);
        }
        return 0;
    }


So I guess that there must be a function or class method in the osgDB namespace which gives me a mechanism to query all plugin supported formats given the plugin file referenced by *itr. The problem is that I can't find it in the documentation at first sight.
Back to top
View user's profile Send private message
Chris 'Xenon' Hanson
Guest





PostPosted: Thu Jun 30, 2011 1:14 am    Post subject:
How to get the listof supported file formats
Reply with quote

Quote:
osgDB::outputPluginDetails(std::cout,*itr);
So I guess that there must be a function or class method in the osgDB namespace which gives me a mechanism to query all plugin supported formats given the plugin file referenced by *itr. The problem is that I can't find it in the documentation at first sight.

It looks like the source to outputPluginDetails shows you what you need?

osgDB/PluginQuery.cpp

--
Chris 'Xenon' Hanson, omo sanza lettere. http://www.alphapixel.com/
Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. Contracting.
"There is no Truth. There is only Perception. To Perceive is to Exist." - Xen


------------------
Post generated by Mail2Forum
Back to top
Paul Martz
Guest





PostPosted: Thu Jun 30, 2011 3:50 pm    Post subject:
How to get the listof supported file formats
Reply with quote

On 6/29/2011 4:15 PM, Daniel Peraza wrote:
Quote:
I thought that ReaderWriters were registered at startup. If you had not told me, I'd never noticed because documentation about it's very reduced.

On the contrary, I'd wager that OSG's plugin system is one of the
better-documented features in OSG.

Did you read chapter 2.5 of the OSG Quick Start Guide?

http://www.lulu.com/product/file-download/openscenegraph-quick-start-guide/1144915?productTrackingContext=search_results/search_shelf/center/1

Granted, the book predates the introduction of the plugin query interface, but
certainly it covers (in detail) the fact that plugins are loaded on demand and
registered during load...
-Paul



------------------
Post generated by Mail2Forum
Back to top
danielperaza
Newbie


Joined: 28 Jun 2011
Posts: 16

PostPosted: Thu Jun 30, 2011 4:17 pm    Post subject:
Sorry
Reply with quote

No, sorry. Quick Start Guide is great, but it was too dense for me given that I'm a newbie looking for a way to make progress quickly. So I preferred to look at the new OSG 3.0 book and the doxygen docs. (The doxygen docs has much classes/methods documentation missing).

Anyway, thanks a lot everybody, I think I've found my way to do what I wanted.
Back to top
View user's profile Send private message
Lane
Newbie


Joined: 05 Feb 2010
Posts: 3

PostPosted: Tue Jul 05, 2011 12:20 am    Post subject:
How to get the listof supported file formats
Reply with quote

Hi,

Everybody,I cannot post new topic,it always shows "Topic is awaiting approval ",so I'm forced to find help here,sorry for distracting your attention!
I got some problem in the terrainmodeling by VPB.
1,I find many code like"log(osg::INFO,"SourceData::readShapeFile")" in the VPB's source,I wonder if i can output the log's data into a file when I use the osgDEM,so I can track what's done during the modeling process.
2,If I want to get the terrain model of just exactly the area in a polygon,for example,300m within the centerline of a highway,while the part that is outside of the polygon is not generated to improve the rendering performance. How can I achieve it,just set the DEM value to NoData for the useless area,or rewrite some important function in the DestinationTile or somewhere.

3,are them compatible between the VPB's latest version and OSG3.0.


Thank you All!Any suggestion is appreciated!

Cheers,
Lei



------------------ Original ------------------
From: "Daniel Peraza"<>;
Date: Fri, Jul 1, 2011 00:17 AM
To: "osg-users"<>;

Subject: Re: How to get the listof supported file formats


No, sorry. Quick Start Guide is great, but it was too dense for me given that I'm a newbie looking for a way to make progress quickly. So I preferred to look at the new OSG 3.0 book and the doxygen docs. (The doxygen docs has much classes/methods documentation missing).

Anyway, thanks a lot everybody, I think I've found my way to do what I wanted.

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







------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Backward compatibility of osgb file t... saedrna1 General 4 Thu Nov 02, 2017 8:20 am View latest post
No new posts Tiff File to .Osg file conversion Latha Rani General 2 Tue Oct 24, 2017 7:06 am View latest post
No new posts custom file GeekOwl Plugins [osgPlugins] 1 Thu Oct 12, 2017 12:32 pm View latest post
No new posts How to open shape file (.shp) or open... GISDeveloper General 0 Thu Oct 05, 2017 3:30 pm View latest post
No new posts OSG compatible models in obj and othe... jaisingla General 0 Mon Sep 18, 2017 4:45 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP