                level parameter.
   :dilate    - increases the light areas with the amount defined by
                the level parameter."
-  ([mode]
-     (let [mode (resolve-constant-key mode filter-modes)]
-       (.filter (current-surface) (int mode))))
+  ([mode-or-shader]
+    (cond (keyword? mode-or-shader)
+          (let [mode (resolve-constant-key mode-or-shader filter-modes)]
+            (.filter (current-surface) (int mode)))
+
+          (instance? processing.opengl.PShader mode-or-shader)
+          (.filter (current-surface) ^processing.opengl.PShader mode-or-shader)
+
+          :else
+          (throw (IllegalArgumentException. "(filter mode-or-shader) takes only keyword or PShader"))))
   ([mode level]
      (let [mode (resolve-constant-key mode filter-modes)]
        (.filter (current-surface) (int mode) (float level)))))


(defn
  ^{:requires-bindings true
    :processing-name "loadShape()"
    :category "Shape"
    :subcategory "Loading & Displaying"

    :added "1.0"}
  rect
  "Draws a rectangle to the screen. A rectangle is a four-sided shape
  with every angle at ninety degrees. By default, the first two
  parameters set the location of the upper-left corner, the third
  sets the width, and the fourth sets the height. These parameters
  may be changed with rect-mode.

  To draw a rounded rectangle, add a fifth parameter, which is used as
  the radius value for all four corners. To use a different radius value
  for each corner, include eight parameters."
  ([x y width height]
     (.rect (current-surface) (float x) (float y) (float width) (float height)))
  ([x y width height r]
