Image Sequence to Texture Problem

Hi there,

This is my first post on the forum. I'm very new to jMonkeyEngine, and fairly new to Java in general, but am otherwise an experienced programmer. I'm loving the engine, and it's really drawing me into the Java language also.

This is my problem: I'm trying to create a class to load an image sequence of transparent PNG's into a texture.

I've examined a lot of examples, especially those on writing video and webcam images to textures, but I think an image sequence might be the simplest for my situation. We want to use animated billboards for characters in an augmented reality project.

I think I'm close, and as far as I can tell I'm doing everything properly, but I'm having some trouble here:

         URL imageURL = this.getClass().getResource("path/to/the/next/image.png");
         Image newImage = TextureManager.loadImage(imageURL, false); //the image is definitely loading

        Renderer renderer = display.getRenderer();
        renderer.updateTextureSubImage(_mainTexture,0,0,newImage,0,0, 512, 512);

this produces the following errors:

Exception in thread "Timer-0" java.lang.NullPointerException
        at org.lwjgl.opengl.GL11.glGetInteger(
        at com.jme.renderer.lwjgl.LWJGLRenderer.updateTextureSubImage(

the line in LWJGLRenderer (in the updateTextureSubImage function) is as follows:

         final IntBuffer intBuf = BufferUtils.createIntBuffer(16);
        GL11.glGetInteger(GL11.GL_TEXTURE_BINDING_2D, intBuf); //this line throws the error

Before trying this technique, I attempted to update the texture by using...


...but the texture doesn't update at all.

just to include my init code too, this is how I'm setting up the texture:

          URL tURL = this.getClass().getResource("/path/to/the/first/image.png");

          _mainTexture = TextureManager.loadTexture(tURL,
            TextureState ts = display.getRenderer().createTextureState();
            ts.setTexture( _mainTexture );

I'm hoping I'm just missing some small detail. Any suggestions would be extremely welcome.