Modify texture in real time

Hi.
We are writing a simulator for a mine clearance engine for our diploma project. (www.digger.ch, if you’re interested…)

The vehicle is moving on a terrain. The terrain is generated with Terragen, the geometry is a triangle array, and it has a texture which is applied with the help of a TexCoordGenerator.

Now, we need a way to mark the places where the vehicle has been (in other words, to leave a trace), by changing the color of the ground.
We tried to change the awt.image used as the texture, and to reapply it each time, but it is way too heavy (both the texture and the terrain geometry are huge).

Could anybody explain how to change the pixels of a texture on the fly, without to have to reload/reapply it each time ? Is there a way to do this ? Or is there any better method to “mark” the ground ? Any input would be appreciated ! (I would prefer not to use the vertices color, since the heightmap we use for the terrain has a lower definition than the texture. The effect would not be very precise.)

Thanks in advance,

Pierre

I am posting broadly in ignorance here, but I think you are looking for TextureByReference stuff- there is a demo that comes with Java3D that may be a useful starting point.

Can’t you split the texture up into several smaller textures so you don’t have to edit the entire landscape’s texture each time?

Just a thought…

-Trond

Thank you two for your replies.

@Breakfast : yep, tha’ts what I was looking for. I dug into the example and managed to make it work with my code. I had (amongst other things) to find the working combination of buffered image format and image component format…

@Trond_A : could have been a possibility, if the first didn’t work… Anyway, it would have demanded much more work, and time is short in this kind of projects…

Pierre