Hi Tobias,
On Wed, 2004-07-14 at 09:57, Tobias Berghoff wrote:
> Hi!
>
> I have a couple of pngs which store a texture and its mip levels. Is there
> a way to read these into an Image directly, or do I have to read the
> images in myself and combine them into a format, where Image::set can
> extract the mipmaps (ad described in the docs)?
>
> Something like combining serveral Image objects into a single Image would
> be nice.
yep, would be nice. But you're the first one to ask for this, so we
haven't added it and I don't know of anybody else who might have that
code.
In any case, I wouldn't expect that to be a big deal, something along
the following lines should work:
ImagePtr result = Image::create();
ImagePtr img = Image::create();
img->read(basename);
result->set(img->getPixelFormat(), img->getWidth(), img->getHeight(),
img->getDepth(), img->calcMipmapLevelCount());
memcpy(result->getData(0), img->getData(), img->getPixel().size());
for(UInt16 i = 1; i < result->getMipMapCount(); ++i)
{
img->read(levelname[i]);
memcpy(result->getData(i), img->getData(), img->getPixel().size());
}
subRefCP(img);
(add begin/endEditCPs; untested code, no guarantees ;)
Hope it helps
Dirk
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users