Hi Roger,
Roger wrote:
> Hello,
>
> I'm trying to generate a single texture file from a few .png images that
> may be provided by the user. I can't seem to find success on how to do
> that with the Image routines. I have loaded in a 256x64 image and then
> doubled its width via img->setWidth(...) in hopes of appending another
> 256x64 image beside the original and saving the end result to file
> (which is later referenced by a 3ds file). I'm trying to use:
>
> osg::ImagePtr res = osg::Image::create();
> beginEditCP(res);
> res->read("ads/ads.png");
> res->setWidth(img1->getWidth() + img2->getWidth()); //this will
> set width of texture based on images
> res->setSubData(256, 1, 1, img1->getWidth(), img1->getHeight(),
> img1->getDepth(), img1->getData());
> res->setSubData(img1->getWidth(), img1->getHeight(),
> img1->getDepth(), img2->getWidth(), img2->getHeight(),
> img2->getDepth(), img2->getData());
> endEditCP(res);
> res->write("models_p/test.png");
>
> this doesn't do anything though. Please help me, I'm stumped.
See Marcus' post for an alternative approach using set.
But: both approaches will not really do what you want, they will create
a new image with no data. To compose the images you should create an
empty Image with the size you want and then copy the parts into it using
Image::setSubData().
Hope it helps
Dirk
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users