Assigning mip level images manually #1353
Unanswered
giterino-0
asked this question in
Q&A
Replies: 2 comments 3 replies
-
Hi, to set mipmaps manually, you may use Image::setMipmapLevels() to setup a list of data offsets first, and copy mipmapping level-'i' to Image::getMipmapData(i). Everything is done in the image object instead TextureCubeMap. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi giterino,
the trick is to allocate the buffer yourself and pass it to setImage. an
example can be found in the dds reader/writer:
OpenSceneGraph\src\osgPlugins\dds\ReaderWriterDDS.cpp
short summary:
unsigned char* imageData = new unsigned char [sizeWithMipmaps];
//fill data buffer with image and mipmaps, fill mipmap_offsets
osgImage->setImage(s,t,r, internalFormat, pixelFormat, dataType, imageData,
osg::Image::USE_NEW_DELETE, packing);
if (mipmap_offsets.size()>0) osgImage->setMipmapLevels(mipmap_offsets);
regards, Laurens.
…On Mon, Jan 13, 2025 at 9:56 AM giterino-0 ***@***.***> wrote:
As far as i checked, mip offsets in an Image are controlled by a list of
indices that is cleared on the first line of Image::allocateImage() _(
*mipmapData)*, causing the allocated block _(*data)* to only have enough
memory for mip 0.
So either there are more ways to allocate the image that i missed, or
_mipmapData is simply ignored.
Thanks for your time.
—
Reply to this email directly, view it on GitHub
<#1353 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEXFTWQQG4BDQPM4ZWKVICL2KN5R7AVCNFSM6AAAAABU7YNKLWVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOBRG43DENQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: <openscenegraph/OpenSceneGraph/repo-discussions/1353/comments/11817626
@github.com>
|
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I can't figure out how to set every mip level image of a TextureCubeMap (without automatic mip generation), Are there any examples that do this?
Beta Was this translation helpful? Give feedback.
All reactions