Marcus Lindblom wrote: > Antonio Bleile wrote: >> Hi, >> >> how about this code here: >> >> ImagePtr img1 = Image::create(); >> >> beginEditCP(img1); >> img1->set(Image::OSG_RGBA_PF, 512, 512); >> endEditCP(img1); >> >> beginEditCP(m_pCopyTexture2); >> m_pCopyTexture2->setMinFilter(GL_LINEAR); >> m_pCopyTexture2->setMagFilter(GL_LINEAR); >> m_pCopyTexture2->setTarget(GL_TEXTURE_2D); >> m_pCopyTexture2->setInternalFormat(GL_RGBA8); >> m_pCopyTexture2->setImage(img1); >> endEditCP(m_pCopyTexture2); >> >> >> When am I supposed to delete img1? Is the destructor >> of the texture taking care? If I use subRefCP of the >> image immediately, the system crashes. If I apply the >> OpenGL metaphor on this sample, I would expect that >> I can delete the image. But obviously the image is >> uploaded to texture memory later.... > > AFAIK, you can't really do that. OpenSG always keep a copy around due to > clustering, etc. > > However, it _may_ work to render using the image (or validate it to a > window, same thing), then subref it. But I would expect that the > TextureChunk will get upset (i.e. crash) when it is destructeed as it > also tries to subref it. And if you set it's imageptr to zero, it will > upload an empty image during the next rendering.
Mh well.. As I make quite some use of fake FBO's, my application starts up consuming 400BM without loading any user data. I'd guess some of it is used up by Images. Wouldn't it be good to have a flag telling the TextureChunk to subref the image as soon as it has uploaded the texture? I don't know of any side-effects though. E.g. what should the getImage method return? A NullFC perhaps? Anyway, in my case I just need to set the size of the texture (and handle resize...), nothing else. Regards, Toni -- Ing. Antonio Bleile Seac02 S.r.l. via Avogadro 4 10121 Torino Italia Tel. +39.011.197.006.52 Fax +39.011.197.006.53 E-mail [EMAIL PROTECTED] Sito www.seac02.it ------------------------------------------------------------------------- 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
