How to update part of a texture only?

Hi there,

I found I can update a texture from a ByteBuffer by using: (Scala syntax, but simple)

var texture: Texture = null
def onPaint(popup: Boolean, dirtyRects: Array[Rectangle], buffer: ByteBuffer, width: Int, height: Int) {

My question is, how can I update just part of the texture such as the first 100 vertical lines of the texture?

THanks! Philip

It’s a shame there has been no responses to this thread.

Well you can get the raw buffer and calculate the byte offsets for it and change it directly, alternativly you can modify it using imagepainter for convinience.

May I ask why you need to update a texture often? Maybee there is an alternative approach possible.

Essentially, hud equipment display updates and camera artifact effects.

I see you have commented on the thread I started that is discussing this…


Hm hud for equipment.

I would do it either with multiple quads and just materialized images for each item, and bear with the minimal overhead of updating to much data. For normal systems the preparing of the upload of the texture is way more expansive than the actual data transfer anyway.

Yes, I run the updates on a separate thread to which the results (modified buffered) are queued. The queue is then synchronized with the renderer to update the image.

The renderer phase just essentially transfers the buffers to the card.