processing

Depth of Field shader for points/strokes in Processing

孤街浪徒 提交于 2019-12-07 23:53:21
问题 Recently I've been using the Depth of Field shader below (originally from the ofxPostProcessing library for OpenFrameworks) for my Processing sketches. depth.glsl uniform float maxDepth; void main() { float depth = gl_FragCoord.z / gl_FragCoord.w; gl_FragColor = vec4(vec3(1.0 - depth/maxDepth), 1.0); } dof.glsl uniform sampler2D texture; varying vec4 vertexture; varying vec4 vertTexCoord; uniform sampler2D tDepth; uniform float maxBlur; // max blur amount uniform float aperture; // aperture -

Buggy bouncing balls

我们两清 提交于 2019-12-07 17:23:26
问题 I was making a colliding ball sketch in Processing, and I encountered a weird bug. Despite having a condition for bouncing off of the walls, some balls get stuck to it . I can't find the source of error here. Can someone help? I also realise that there maybe few (a lot) bad coding practices, but I apologise beforehand. I am posting the codes below. 1) Main : https://pastebin.com/hv0H14gZ particle[] elec = new particle[5]; boolean record = false; void setup(){ float x=0,y=0; int i,j; float

Android - Processing Build not compiling

我们两清 提交于 2019-12-07 12:58:25
问题 I'm having issues with the IDE Processing. I'm trying to compile something to Android. I'm on Android Mode, of course. But I'm getting this Error at the time of compiling. (It's not the code itself) I've installed "adb devices", it seems Ok. I've done all the "51-android.rules" process. I've installed API 10(the one requested) and Android Tools. I don't really know what should be wrong. ----------------- API<=15: Adding annotations.jar to the classpath. [echo] ---------- [echo] Building

SimpleDateFormat always returns 1970.01.17 with wrong timezone

点点圈 提交于 2019-12-07 04:03:56
问题 I have been using Processing 3.0, and I am trying to print a simple timestamp when my Arduino outputs certain values, but it is not working. I tried to use SimpleDateFormat, but it always returns 1970.01.17 17:48:35 GMT , rather than the actual time. Below is the MVCE: void setup () { SimpleDateFormat format = new SimpleDateFormat ("yyyy.MM.dd HH:mm:ss z"); format.setTimeZone (TimeZone.getDefault()); long timestamp = getTimeNow(); println(format.format(new Date(timestamp))); println(timestamp

processing基本图形绘制

折月煮酒 提交于 2019-12-06 15:24:55
示例代码(processing画圆): 1 void setup() 2 { 3 //初始化创建一个960*480像素大小的窗口 4 size(960,480); 5 smooth(); 6 } 7 8 void draw() 9 { 10 //当鼠标被按下时,圆变成黑色 11 if(mousePressed) 12 { 13 fill(0); 14 } 15 //鼠标未按下,圆是白色 16 else 17 { 18 fill(255); 19 } 20 //绘制一个直径为80的圆 21 ellipse(mouseX,mouseY,80,80); 22 } 23 运行结果如下: Processing基本图形绘制函数: 绘制直线line(x1,y1,x2,y2) 绘制三角形triangle(x1,y1,x2,y2,x3,y3) 绘制四边形quad(x1,y1,x2,y2,x3,y3,x4,y4) 绘制矩形rect(x,y,width,height) 绘制圆形或椭圆ellipse(x,y,width,height) 绘制扇形arc(x,y,width,height,start,stop) 来源: https://www.cnblogs.com/YanQing1998/p/11992810.html

How to keep a color in a fill() the same after mousePressed?

穿精又带淫゛_ 提交于 2019-12-06 15:21:20
What would be the easiest and simplest way to keep the fill() the same after clicking (that's when it changes) and then unclicking, and leaving hover? In this project, I simply made a grid. When the mouse hovers over a specific rect (at x , y ) it changes color based on the state it is in. fill(50) is the default, fill(75) is when the mouse is hovering, and fill(100) is when the mouse clicks. But here when the mouse is unclicked it returns to hover fill until the mouse leaves the rectangle. Thanks. int cols, rows; int scl = 20; void setup() { size(400, 400); int w = 400; int h = 400; cols = w

Processing / C920 logitech capture frame rate video discourse

依然范特西╮ 提交于 2019-12-06 13:00:47
问题 I'm developing on Processing 2.0b, and i just bought a C920 logitech webam for a good capture quality. Then I try to capture at 1920 x 1080 , the problem is that I'm under 15 fps per seconds.. When I list all the devices availsable to capture, the program write: Some size and fps ... -[61] "name=HD Pro Webcam C920,size=1024x576,fps=5" -[62] "name=HD Pro Webcam C920,size=1024x576,fps=30" -[63] "name=HD Pro Webcam C920,size=1280x720,fps=5" -[64] "name=HD Pro Webcam C920,size=1280x720,fps=30" -

SqLite Multicore Processing

折月煮酒 提交于 2019-12-06 11:05:44
How do you configure SqLite 3 to process a single query using more than 1 core of a CPU ? Since version 3.8.7, SQLite can use multiple threads for parallel sorting of large data sets. sqlite3 itself does not do that. However, I have a project called multicoresql on github that has utility programs and a C library for spreading sql queries onto multiple cores. It uses sharding so you have to break your large database or datafile into multiple sqlite3 database files. A single SQL query must be written as two SQL queries, a map query that first runs on all the shards, and a reduce query to

Processing 3d object .obj import

拟墨画扇 提交于 2019-12-06 11:00:23
I'm trying to import 3d objects in Processing from .obj files found on the web. I've seen that there are several ways to import objs into the scene. I'm using PShape in this example and an obj file found here . I've started from the Examples>Basic>Shape>LoadDisplayObJ sample in which textures work. I was able to import the obj file using the loadShape function but no textures and colors were displayed. Am I missing something? Should I import the .mtl file as well? Here is the code: PShape house; float ry; public void setup() { size(640, 360, P3D); house = loadShape("huts/huts.obj"); } public

Processing (Java): List of reasons why a library won't be detected (Linux)

一世执手 提交于 2019-12-06 07:25:33
There are apparently numerous reasons why Processing will not detect the installation of an external library. 1) Library installed in wrong folder The library must be installed in a directory "libraries" in the sketchbook folder, which is probably not in the installation directory. Careful Linux is case sensitive so libraries and Libraries are two different directories, as are sketchbook and Sketchbook. 2) Library installed in correct folder but wrongly referenced It's possible to confirm the current sketchbook directory used by Processing by looking in "Preferences" in the "File" menu of the