here is my little problem: a square in a canvas much like Andrew Davidson´s new JOGL stuff. im using active rendering, and basically i want to draw a different image(actually a diferent part of a png image) in each passing of the rendering loop. im using alpha testing and blending so i dont draw the parts of the image i dont want (if its a ball, i want only the ball, not a white square behind it.). but it keeps the image drawn the last time, and since the images are changing constantly, its a problem. if i use clearRect in the graphics (as sen bellow) i get a black square. How do i clean the texture to draw a fresh image without pieces of the old image still showing? Any ideas are welcome. the code below would be somewhere in the renderScene code, witch is called constantly to draw on the screen. testTextureRenderer os a TextureRenderer object, bim is a previously loaded BufferedImage, animposx is a int indicating the beginning of the image to be drawn. later on on the code i would use testTexture (a Texture object) methods like enable, bind and disable, when rendering the square, wich is in a glList.
In each passing of the loop im updating witch part of the image i want showing. the whole problem is to clean the Graphics2D of the TextureRenderer before drawing the next image, but keeping the transparent part still visible (i still want to see the canvas behind it where there pixels with alpha>0 in the image).
Graphics2D g = testTextureRenderer.createGraphics();
g.clearRect(64, 64, 64, 64);
g.drawImage(bim.getSubimage(animposx, 0, 128, 128), null, 0, 0);
animposx++;
if(animposx >= 127)
{animposx = 0;}
testTextureRenderer.sync(0, 0, 128, 128);
testTexture = testTextureRenderer.getTexture();
g.dispose();