Passing parameters into shader programs
The shaders we have seen so far simply apply a non-configurable filter to a texture, and nothing more. You will most likely want to have richer effects in your applications, some that change over time and others that take into account external factors such as user input. This recipe is all about uniforms, which let us send parameters from the Java code into the vertex and fragment shader scripts.
We will add a vignette effect to our classic jungle background. The shader will create a circle in the center of the screen and darken everything that falls out of it. From the code, we will increase and decrease the circle's radius so that it looks like a scene transition. Refer to the following diagram for further ...
Get Libgdx Cross-platform Game Development Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.