Draw (shapes) to a texture/sprite in libGDX -


in libgdx game have several sprites share same texture. want "manually" draw onto of sprites (i.e. want change of pixels in of sprites).

how can modify texture shared amongst seveal sprites without affecting other sprites?
guess need copy texture before set sprite?

you can use custom shader customize sprite texture.

before drawing sprite spritebatch, say:

spritebatch.begin();  spritebatch.useshader(shaderprogram1); sprite1.draw(...); spritebatch.useshader(shaderprogram); sprite2.draw(...);  ...  spritebatch.end(); 

if aren't familiar shaders can check link: https://github.com/libgdx/libgdx/wiki/shaders

also there option use frame buffer object, texture customization, think if texture difference aren't huge, best solution if looking best performances.

hope gives idea.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -