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

php - How to serve a file for download on WordPress -

how to share virtual sharepoint server and get it in host windows and visual studio? -