Currently, creating a game and trying to make an overlay to cover the screen when you press the "menu" button - what I think should be quite common / simple, but still having problems with its implementation.
My current setting:
- TiledMapRenderer: display TMX tiles (background / map)
- SpriteBatch: for various assets (e.g. player image)
- Stage: hold menu buttons
- ShaderProgram: using GLSL to create an overlay / shader effect
- SpriteBatch and map configured to use ShaderProgram
As suggested by many people, for performance I use only one SpriteBatch - therefore the same batch of sprites is used by both different assets and a menu item.
The goal of the shader is to add a dark / translucent overlay to the gray screen so that the menu is easier to read when it is open.
The main problem I am facing is that since the assets and menus have the same SpriteBatch, they also use the same shader ... so when I turn on the shading effect everything (background and menu buttons) greyed out.
How can I use only one SpriteBatch, but apply Shader only to the background (and keep the menu buttons normal / asymmetrical)?
source share