Updating subimages of a texture

If I only need to change a subrectangle of a texture image, what is the fastest way to do it?

AFAIK, this is only possible if you use LWJGL directly or via ImageGraphics - you might want to give that a try.

I'm new to JME. Where can I find documentation which describes the intermixing of

JME and LGJGL rendering?

No such documentation exists…

jME keeps track of the GL state with the RenderContext and ***StateRecord classes. If you change a state that jME can also change then you need to modify the records to reflect your changes.

(or inform jME that its records are invalid…)

In this instance all I would be doing is to always update a particular texture via LWJGL. I will never

change it via JME. In this case do I really need to notify JME of anything?

Also, given a JME texture, how can I find it's corresponding LWJGL texture?

There is no such thing as an "lwjgl texture".  Textures have a texture id, which is created by opengl and stored in jME's texture object.  You can use this id in your direct Opengl calls (via lwjgl for example) to manipulate the texture, but you're basically issuing commands to opengl, not to some lwjgl data object.

Keep in mind that jME tracks the texture state properties (but not the image data) associated with a given texture, so if you are changing anything other than the texture's image data, you will in fact need to tell jME to ignore its current idea of how the texture is setup.  You can do that by calling setNeedsRefresh on the texture states that use a given texture or by invalidating the texture record or context.

Thanks. Makes sense. Now I need (hopefully) just one more bit of info: how do I get

a handle to the LWJGL context object?

You don't really need the context if you just want to update the texture, you only need to make the necessary calls in the GL thread.

Ah, I see now. The LWJGL GL11 methods are all static, so there is a single context.

So all I need to do is call GL11.glTexSubImage2D.

One more question: in order to use GL11.glTextureSubImage2D I need to first use GL11.glBindTexture to bind the 2D

texture target to my desired texture id. Is this going to mess up JME in any way? Does JME ever assume that

certain textures are bound to texture targets over periods of time or does it always bind a target to a texture

before it accesses the texture via the target?

It tracks the currently bound texture, so yes, that could screw things up.  Since you are directly using lwjgl, you can use the static method in LWJGLTextureState called doTextureBind to do the bind and keep jME in the know.

Thanks. I found doTextureBind in the source but not in the javadoc on http://www.jmonkeyengine.com/doc. Does this mean that the web

javadoc is out of date? How out of date is it?