Hi, in my experience it's not easy to get rid of a BufferedImage. In the
Java 3D Scala sample program ScCharacterCube (
http://www.interactivemesh.org/testspace/j3dmeetsscala.html) it seems to work. Following tips might be helpful:
- Cache and reuse the BufferedImage instance as long as its size or type doesn't change.
- Prevent ImageComponent2D from copying image data by using this constructor
'new ImageComponent2D(myFormat, myWidth, myHeight, true, true)' which creates an instance in 'byReference' and 'yUp'-mode.
- Don't be shy of running the garbage collector (System.gc()) as soon as references are set to null.
Even if the sample is written in Scala see how the object/subclass 'offCanvas3D' in the source code of 'CharacterCubeUniverse.scala' is designed. It includes also the def/method 'flipImageY(bImage: BufferedImage)' to flip your image into 'yDown'-mode.
August, InteractiveMesh