[osg-users] cannot load PNG image

512 views
Skip to first unread message

Tufan Taş

unread,
Jan 7, 2010, 5:30:21 AM1/7/10
to osg-...@lists.openscenegraph.org
Hi,

I am trying to load a PNG image as
osg::ref_ptr<osg::Image> image1 (osgDB::readImageFile("C:\\Users\\Tufan\\Desktop\\wood.png"));

Thank you!

Cheers,
Tufan

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

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Robert Osfield

unread,
Jan 7, 2010, 6:07:53 AM1/7/10
to osg-...@lists.openscenegraph.org
Hi Tufan,

Do you have the png plugin built? Check your osgPlugins-version/
directory for which osgdb_*.dll you have. If you don't have it you'll
need to grab the 2rd party dependencies compile the OSG from source.
See the documentation on compiling the OSG on the wiki.

Robert.

Tufan Taş

unread,
Jan 7, 2010, 6:28:41 AM1/7/10
to osg-...@lists.openscenegraph.org
Hi,

I have osgdb_png.dll in C:\Users\Tufan\Desktop\New Folder\OpenSceneGraph-2.8.2\bin\osgPlugins-2.8.2 directory.
But still cannot load PNG.
Thank you!

Cheers,
Tufan

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=22212#22212

Robert Osfield

unread,
Jan 7, 2010, 6:38:41 AM1/7/10
to osg-...@lists.openscenegraph.org
Hi Tufan,

On Thu, Jan 7, 2010 at 11:28 AM, Tufan Taş <tas....@gmail.com> wrote:
> I have osgdb_png.dll in C:\Users\Tufan\Desktop\New Folder\OpenSceneGraph-2.8.2\bin\osgPlugins-2.8.2 directory.
> But still cannot load PNG.

Check that this OpenSceneGraph/bin directory is on your path.

Robert.

Tufan Taş

unread,
Jan 7, 2010, 6:47:01 AM1/7/10
to osg-...@lists.openscenegraph.org
Hi,

Yes C:\Users\Tufan\Desktop\New Folder\OpenSceneGraph-2.8.2\bin is in my path. I don't get any error messages I can load bmp image but cannot png. I don't know why.

Thank you!

Cheers,
Tufan

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=22214#22214

selman duatepe

unread,
Jan 7, 2010, 8:59:31 AM1/7/10
to osg-...@lists.openscenegraph.org

Hi Tufan,

Check also that C:\Users\Tufan\Desktop\New Folder\OpenSceneGraph-2.8.2\bin\osgPlugins-2.8.2 directory is in your path. If directory is in your path, attach your texture and code. I will try it. 

Selman

Robert Osfield

unread,
Jan 7, 2010, 9:07:54 AM1/7/10
to OpenSceneGraph Users
Hi Tufan & Selman,

On Thu, Jan 7, 2010 at 1:59 PM, selman duatepe <selman...@gmail.com> wrote:
> Check also that C:\Users\Tufan\Desktop\New
> Folder\OpenSceneGraph-2.8.2\bin\osgPlugins-2.8.2 directory is in your path.

I would not advice this, as this can cause problems later on when you
might start mixing different OSG versions on the same machine and have
paths pick up the wrong set of plugins which can cause a crash. The
osgPlugins-version directory is deliberately versioned to avoid this
mixing versions issue, and osgDB knows about this scheme so will
automatically append the osgPlugin-version directory so there is no
need to add anything more than the parent directory where the plugins
are.

A better thing to look at next is whether the plugin is loading for
this you can enable verbose debugging to see whether the plugin has
been located and loaded. In a terminal type:

set OSG_NOTIFY_LEVEL=DEBUG
runmyapp mymodel.osg

Then look at the console output, in particular look for notifications
about plugin loading.

Robert.

Jean-Sébastien Guay

unread,
Jan 7, 2010, 9:12:00 AM1/7/10
to osg-...@lists.openscenegraph.org
Hi Tufan,

> Yes C:\Users\Tufan\Desktop\New Folder\OpenSceneGraph-2.8.2\bin is in my path. I don't get any error messages I can load bmp image but cannot png. I don't know why.

The difference is that the BMP plugin does not need any additional DLLs
(other than the plugin itself of course) but the PNG plugin does
(something like libpng13.dll). So I suspect you don't have this DLL.

This DLL is part of the 3rdParty dependencies, so you either have it
already (if you compiled OSG from source) or you need to download the
appropriate 3rdParty dependencies for your version of Visual Studio. See
this page:

http://www.openscenegraph.org/projects/osg/wiki/Downloads/Dependencies

You could then copy all the DLLs from your 3rdparty\bin folder to your
OpenSceneGraph-2.8.2\bin folder so it will be found when osgDB loads the
PNG plugin.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay jean-seba...@cm-labs.com
http://www.cm-labs.com/
http://whitestar02.webhop.org/

Mourad Boufarguine

unread,
Jan 7, 2010, 9:20:29 AM1/7/10
to OpenSceneGraph Users
Hi Tufan,

Did you add the bin folder of the 3rdParty directory to your path ? Maybe your program don't find the libpng13.dll.

Mourad

Tufan Taş

unread,
Jan 7, 2010, 9:26:52 AM1/7/10
to osg-...@lists.openscenegraph.org
I have tried all of your comments add the path of plugins bin but not worked also I have previously downloaded 3rdparty dependencies coppied libpng13.dll into my osg bin but still not working. Do you have any more comments I am really stucked

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=22230#22230

Jean-Sébastien Guay

unread,
Jan 7, 2010, 9:29:49 AM1/7/10
to osg-...@lists.openscenegraph.org
Hi Tufan,

> I have tried all of your comments add the path of plugins bin but not worked also I have previously downloaded 3rdparty dependencies coppied libpng13.dll into my osg bin but still not working. Do you have any more comments I am really stucked

Try setting OSG_NOTIFY_LEVEL=DEBUG before running, it will print lots of
info to the console and might help pinpoint the problem. Also try
DependencyWalker (google it) if that doesn't help.

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay jean-seba...@cm-labs.com
http://www.cm-labs.com/
http://whitestar02.webhop.org/

Tufan Taş

unread,
Jan 7, 2010, 9:42:40 AM1/7/10
to osg-...@lists.openscenegraph.org
Thanks for your advices adding 3rdParty path solved my problem for PNG file. But still I cannot load a .flt file.
My osgPlugins-2-8-2 directory contains osgdb_openflight.dll but nothing appears on the screen.

Cheers,
Tufan

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=22234#22234

Mourad Boufarguine

unread,
Jan 7, 2010, 9:43:09 AM1/7/10
to osg-...@lists.openscenegraph.org
Which 3rdParty archive did you download and what is your VS version ? SP1 ?

What do you get when setting osg notify level to debug ? ( osg::setNotifyLevel(osg::DEBUG_INFO))

Mourad

Tufan Taş

unread,
Jan 7, 2010, 9:51:06 AM1/7/10
to osg-...@lists.openscenegraph.org
3rdParty_Win32Binaries_vc90sp1
I get nothing when setting notify level.

Cheers,
Tufan

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=22238#22238

Tufan Taş

unread,
Jan 7, 2010, 10:02:45 AM1/7/10
to osg-...@lists.openscenegraph.org
The following is my code for the openflight mode. Am I missing something in the code? Only blue screen appears.

osg::Node* mapNode;
mapNode = osgDB::readNodeFile("C:\\Users\\Tufan\\Desktop\\buffs.flt");
osg::Group* root = new osg::Group();
root->addChild(mapNode);

osgViewer::Viewer viewer;
viewer.setSceneData( root );

viewer.setUpViewInWindow(100, 100, 640, 480);
viewer.run();

Cheers,
Tufan

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=22239#22239

Mourad Boufarguine

unread,
Jan 7, 2010, 10:12:26 AM1/7/10
to osg-...@lists.openscenegraph.org
mapNode  is it NULL ? Did you try  opening it with osgviewer.exe ? Maybe sharing the file will help finding out.

Tufan Taş

unread,
Jan 7, 2010, 10:22:39 AM1/7/10
to osg-...@lists.openscenegraph.org
No mapNode is not null I initialized it as

void viewWindow()
{
osg::Node* mapNode = osgDB::readNodeFile("C:\\Users\\Tufan\\Desktop\\buffs.flt");

//mapNode = osgDB::readNodeFile("C:\\Users\\Tufan\\Desktop\\wood.png");


osg::Group* root = new osg::Group();
root->addChild(mapNode);


osgViewer::Viewer viewer;
viewer.setSceneData( root );


viewer.setUpViewInWindow(100, 100, 640, 480);

viewer.run();
}

This is the function in my dll. I use it in my c# project. Other isssues work fine like viewing a png image but it does not work for flt.

Thank you!

Cheers,
Tufan

Cheers,
Tufan

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=22242#22242

Chris 'Xenon' Hanson

unread,
Jan 7, 2010, 11:23:50 AM1/7/10
to OpenSceneGraph Users
On 1/7/2010 7:07 AM, Robert Osfield wrote:
> A better thing to look at next is whether the plugin is loading for
> this you can enable verbose debugging to see whether the plugin has
> been located and loaded. In a terminal type:
> set OSG_NOTIFY_LEVEL=DEBUG
> runmyapp mymodel.osg
> Then look at the console output, in particular look for notifications
> about plugin loading.

Ignore any other advice, and do this before you do anything else. OSG has prodigious
error reporting if you set NOTIFY_LEVEL to DEBUG. It will usually tell you exactly what's
going on. If you still can't figure out what it going wrong, use pastebin.ca or something
to put up a copy of the DEBUG output for us to look at. (Don't attach it to your e-mail,
sometimes that can mess up formatting).

--
Chris 'Xenon' Hanson, omo sanza lettere Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
"There is no Truth. There is only Perception. To Perceive is to Exist." - Xen

Tufan Taş

unread,
Jan 8, 2010, 1:04:53 AM1/8/10
to osg-...@lists.openscenegraph.org
Hi,

Thanks for your replies I just rebuil my OSG and the problem is solved.

Cheers,
Tufan

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=22276#22276

Reply all
Reply to author
Forward
0 new messages