Can anyone help me get this dithering filter GLSL shader to work with Panda3D?

devlog-martinsh.blogspot.com/201 … ering.html

```
from panda3d.core import *
import direct.directbase.DirectStart
from direct.filter.FilterManager import FilterManager
manager = FilterManager(base.win, base.cam)
tex = Texture()
quad = manager.renderSceneInto(colortex=tex)
quad.setShader(Shader.load("shaders/filter.glsl", Shader.SL_GLSL))
quad.setShaderInput("tex", tex)
model = loader.loadModel("panda")
model.reparentTo(render)
base.run()
```

I’ve set up a simple scene to see the filter in action, but I get this error:

```
Using deprecated DirectStart interface.
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:shader(error): GLSL shaders must have separate shader bodies!
Traceback (most recent call last):
File "main.py", line 8, in <module>
quad.setShader(Shader.load("shaders/filter.glsl", Shader.SL_GLSL))
TypeError: NodePath.set_shader() argument 1 must be Shader, not NoneType
```

Here’s the slightly modified GLSL shader:

```
#version 130
uniform sampler2D tex;
float Scale = 1.0;
float find_closest(int x, int y, float c0)
{
int dither[8][8] = {
{ 0, 32, 8, 40, 2, 34, 10, 42}, /* 8x8 Bayer ordered dithering */
{48, 16, 56, 24, 50, 18, 58, 26}, /* pattern. Each input pixel */
{12, 44, 4, 36, 14, 46, 6, 38}, /* is scaled to the 0..63 range */
{60, 28, 52, 20, 62, 30, 54, 22}, /* before looking in this table */
{ 3, 35, 11, 43, 1, 33, 9, 41}, /* to determine the action. */
{51, 19, 59, 27, 49, 17, 57, 25},
{15, 47, 7, 39, 13, 45, 5, 37},
{63, 31, 55, 23, 61, 29, 53, 21} };
float limit = 0.0;
if(x < 8)
{
limit = (dither[x][y]+1)/64.0;
}
if(c0 < limit)
return 0.0;
return 1.0;
}
void main()
{
vec4 lum = vec4(0.299, 0.587, 0.114, 0);
float grayscale = dot(texture2D(tex, gl_TexCoord[0].xy), lum);
vec3 rgb = texture2D(tex, gl_TexCoord[0].xy).rgb;
vec2 xy = gl_FragCoord.xy * Scale;
int x = int(mod(xy.x, 8));
int y = int(mod(xy.y, 8));
vec3 finalRGB;
finalRGB.r = find_closest(x, y, rgb.r);
finalRGB.g = find_closest(x, y, rgb.g);
finalRGB.b = find_closest(x, y, rgb.b);
float final = find_closest(x, y, grayscale);
gl_FragColor = vec4(finalRGB, 1.0);
}
```