I have used shaders to create simple black and white effects or blur effects across the entire screen. but is there a way to apply a shader to a portion of the screen. for example I would like to create an object in a game which is a piece of frosted glass that my character could walk behind. so I would Ideally create a shader to create a blur effect only on the area of the screen covered by the frosted glass. is this possible? or is there another approach more suitable?
thanks
I would just enable then disable the shader before and after you render the frosted glass.
For example using a SpriteBatch
:
// Rendering code...
// First set the shader to be used
batch.setShader(myShaderProgram);
/*
Render your frosted glass here
*/
// Go back to the default shader (flushes the buffer too)
batch.setShader(null);
// More rendering code...