We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › how to removeCache() versus OpenGL texture leak
Page Index Toggle Pages: 1
how to removeCache() versus OpenGL texture leak (Read 292 times)
how to removeCache() versus OpenGL texture leak
Dec 19th, 2008, 8:46pm
 
Let's say you have a sketch that brutally abuses texturing in OpenGL, by completely redrawing an offscreen PGraphics each frame, then using it as a texture, forcing all of the entailed conversion work. (that is, without any glTexSub* -type hackery)

In current 1.0 such code seems to leak texture memory.  Depending on texture dimensions it'll run out of memory after some number of frames and bail.

In the olden days of beta you could avoid that particular leak by explicitly coding something like "pimage.cache = null;", then the destructor would release the texture id and clean up after itself, then recreate the OpenGL texture from scratch.  (the brutal abuse)

In 1.0 it seems removeCache() is the new replacement, but as it's not documented, am wondering how to use it, or if I'm even on the right track.  Do I just pass it a reference to "g" (meaning the onscreen OpenGL renderer)?  Or is this leak entirely unexpected and i should be reporting a bug instead?

thx
Page Index Toggle Pages: 1