If you don't need it done in real-time, then you're better off using Photoshop or GIMP to save two copies of your image.
If you need it in real-time or need to process a lot of sprites, using shaders is the ideal solution.
Shader Lesson 3: Grayscale and other effectsCode exampleAnother solution is to process the Pixmap before uploading it to a Texture:
Pixmaps & TexturesYeah it needs to be done in real time. So I'm going with Shaders. I found settings for a default shader as well.
My problem right now is that when I apply the grayscaled shader nothing renders... but when I set the shader to the default it renders everything after it fine.
I'm, obviously, very new to shaders so is there anything simple that I might be missing?
Note: I copied VERT and FRAG entirely from the code example.
This is what takes place in my render...
1 2 3 4 5 6 7 8 9 10 11
| batch.setShader(shader); time += Gdx.graphics.getDeltaTime(); grayscale = (float)Math.sin(time)/2f+0.5f; shader.begin(); shader.setUniformf("grayscale", grayscale); shader.end();
sprite.draw(batch); batch.setShader(default_shader) ... |