File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require 'picrate'
4
+
5
+ class BlendModeSketch < Processing ::App
6
+ java_import 'com.jogamp.opengl.GL3'
7
+ java_import 'com.jogamp.opengl.GLContext'
8
+
9
+ attr_reader :gl
10
+ def setup
11
+ sketch_title 'Blend Mode Difference P2D'
12
+ noStroke
13
+ fill ( 255 )
14
+ # DIFFERENCE is not supported in P2D / P3D
15
+ # blendMode(DIFFERENCE)
16
+ @gl = GLContext . getCurrentGL . getGL2
17
+ end
18
+
19
+ def draw
20
+ background ( 255 )
21
+ # This provides blendMode(DIFFERENCE) in P2D / P3D
22
+ gl . glEnable ( GL3 ::GL_BLEND )
23
+ gl . glBlendFunc ( GL3 ::GL_ONE_MINUS_DST_COLOR , GL3 ::GL_ZERO )
24
+ 20 . times do |i |
25
+ sz = 50 + ( i % 4 ) * 50
26
+ x = width * noise ( i * 0.527 + millis * 0.0003 )
27
+ y = height * noise ( i * 0.729 + millis * 0.0001 )
28
+ circle ( x , y , sz )
29
+ end
30
+ end
31
+
32
+ def settings
33
+ size 600 , 600 , P3D
34
+ smooth 8
35
+ end
36
+ end
37
+
38
+ BlendModeSketch . new
You can’t perform that action at this time.
0 commit comments