Shaders

clipclj

hintclj

no-clipclj

with-graphics

clipclj

Arguments
[x y w h]
Docstring

Limits the rendering to the boundaries of a rectangle defined by the parameters. The boundaries are drawn based on the state of the image-mode function, either :corner, :corners, or :center. To disable use no-clip.

Works only inside sketch functions?
Yes
Original Processing method
clip()
Original p5js method
None.
Example
clojure specific
  • (q/background 255)
    (q/fill 0)
    ; clip rendering so that triangle will be incomplete
    (q/clip 50 100 100 100)
    (q/triangle 100 70 170 180 30 180)
    ; draw normal unclipped triangle
    (q/no-clip)
    (q/with-translation [(/ (q/width) 2) (/ (q/height) 2)]
      (q/triangle 100 70 170 180 30 180))

hintclj

Arguments
[hint-type]
Docstring

Set various hints and hacks for the renderer. This is used to handle obscure rendering features that cannot be implemented in a consistent manner across renderers. Many options will often graduate to standard features instead of hints over time.

Options:

  • :enable-native-fonts - Use the native version fonts when they are installed, rather than the bitmapped version from a .vlw file. This is useful with the default (or JAVA2D) renderer setting, as it will improve font rendering speed. This is not enabled by default, because it can be misleading while testing because the type will look great on your machine (because you have the font installed) but lousy on others' machines if the identical font is unavailable. This option can only be set per-sketch, and must be called before any use of text-font.

  • :disable-native-fonts - Disables native font support.

  • :disable-depth-test - Disable the zbuffer, allowing you to draw on top of everything at will. When depth testing is disabled, items will be drawn to the screen sequentially, like a painting. This hint is most often used to draw in 3D, then draw in 2D on top of it (for instance, to draw GUI controls in 2D on top of a 3D interface). Starting in release 0149, this will also clear the depth buffer. Restore the default with :enable-depth-test but note that with the depth buffer cleared, any 3D drawing that happens later in draw will ignore existing shapes on the screen.

  • :enable-depth-test - Enables the zbuffer.

  • :enable-depth-sort - Enable primitive z-sorting of triangles and lines in :p3d and :opengl rendering modes. This can slow performance considerably, and the algorithm is not yet perfect.

  • :disable-depth-sort - Disables hint :enable-depth-sort

  • :disable-opengl-errors - Speeds up the OPENGL renderer setting by not checking for errors while running.

  • :enable-opengl-errors - Turns on OpenGL error checking

  • :enable-depth-mask

  • :disable-depth-mask

  • :enable-optimized-stroke

  • :disable-optimized-stroke

  • :enable-retina-pixels

  • :disable-retina-pixels

  • :enable-stroke-perspective

  • :disable-stroke-perspective

  • :enable-stroke-pure

  • :disable-stroke-pure

  • :enable-texture-mipmaps

  • :disable-texture-mipmaps

Works only inside sketch functions?
Yes
Original Processing method
hint()
Original p5js method
None.
Example
clojure specific
  • (let [hints [:enable-async-saveframe :disable-async-saveframe :enable-depth-test
                 :disable-depth-test :enable-depth-sort :disable-depth-sort
                 :enable-opengl-errors :disable-opengl-errors :enable-depth-mask
                 :disable-depth-mask :enable-optimized-stroke
                 :disable-optimized-stroke :enable-stroke-perspective
                 :disable-stroke-perspective :enable-stroke-pure
                 :disable-stroke-pure :enable-texture-mipmaps
                 :disable-texture-mipmaps]]
      (doseq [h hints] (q/hint h)))
    (q/ellipse 250 250 400 200)

no-clipclj

Arguments
[]
Docstring

Disables the clipping previously started by the clip function.

Works only inside sketch functions?
Yes
Original Processing method
noClip()
Original p5js method
None.
Example
clojure specific
  • (q/background 255)
    (q/fill 0)
    ; clip rendering so that triangle will be incomplete
    (q/clip 50 100 100 100)
    (q/triangle 100 70 170 180 30 180)
    ; draw normal unclipped triangle
    (q/no-clip)
    (q/with-translation [(/ (q/width) 2) (/ (q/height) 2)]
      (q/triangle 100 70 170 180 30 180))

with-graphics

Arguments
[graphics & body]
Docstring

All subsequent calls of any drawing function will draw on given graphics. with-graphics cannot be nested (you can draw simultaneously only on 1 graphics)

Works only inside sketch functions?
Yes
Original Processing method
None.
Original p5js method
None.
Example
(let [gr (q/create-graphics 250 250)]
  (q/with-graphics gr
    (q/background 255)
    (q/fill 255 0 0)
    (q/triangle 50 30 220 120 20 180))
  (q/image gr 0 0)
  (q/image gr 250 0)
  (q/image gr 0 250)
  (q/image gr 250 250))
try example