Performant way to force texture-update?


I am kind of new to jME and the whole 3D-Thing.

So please excuse if i am asking a real stupid question.

I studied nearly every tutorial on the page and i allready read the f… manual  :slight_smile:

First a little background information:

We (I and a friend) are developing a kind of worms-clone (it is not really a clone, but since worm should be well known it's the easiest way to let you know what we trying to do). We startet several Years ago in C(++) and 2D, but in the meantime we got out of school and professional java-developers, so now we are willing to give java a try for our hobby-programming.

My actual approach for making the level is an array of quads, each Quad has it's own TextureState, with a texture where the land is filled and the rest ist fully alpha.

If an explosion occurs, i manipulate the texture-data (setting als the pixels within the explosionradius to full alpha).

The problem is that manipulating the texture data has no affect on the visual apperance of the quad. I need to force the TextureState to update.

Calling deleteAll() (like in the FlagRush-Tut) does the job, but it is slow as hell, the frame-rate is breaking down.

There must be an more performant way to update the state and forcing jME to recordnize the texturechange.

I've tried to reassign the texture and/or to call updateRenderState() on the Quad, but nothing seems to work.

You could try using glDrawPixels to directly write your image data into the framebuffer.

But I need to draw on the quad, not on the framebuffer.

You should be able to call delete on the TextureState for the quad you are working with.

I thought that the quads are drawn face towards the camera? In that case drawing to the framebuffer would be the same thing.

You should be able to call delete on the TextureState for the quad you are working with.

If he has one texture on the quad, then it would still cause the same amount of performance impact.

Ok, I was thinking for some reason that he must be deleting everything in the cache.  If it's one texture and your are doing it only every so often (not once per frame) I really don't see any reason for a slowdown.  (Are they huge textures?)

Yes, the explosion effect (or whatever) should not be drawn on the quad. Once the effect is gone, fill the correct pixels with alpha and update once.