processing

SimpleDateFormat always returns 1970.01.17 with wrong timezone

一曲冷凌霜 提交于 2019-12-05 10:18:41
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); } long getTimeNow () { Date d = new Date (); Calendar cal = new GregorianCalendar(); long current =

Transform from relative to world space in Processing

…衆ロ難τιáo~ 提交于 2019-12-05 05:56:07
问题 What is a good way of transforming a local relative point, into the world (screen) space in Processing? For example, take the Flocking example that comes with the Processing PDE. How would I implement a relativeToWorld method and a worldToRelative method in the Boid class. These methods would take into consideration, all the transforms done in the render method. I was thinking I would want to transform PVector objects, so the method signatures might look something like: PVector

Exporting a video in p5.js

笑着哭i 提交于 2019-12-05 01:49:53
问题 I am creating a simple animation program in p5.js. When a user clicks the save button, I want to download a video of the animation. I have an object called frames where each key is labelled frame_1 , frame_2 and so on. The value associated with each key is an array of line segments that makes up that frame. I am trying to think of an approach to take this data and create an mp4 video. p5.js has a built in save function that I thought might be helpful but it is not a full solution on its own.

Using processing libraries in processing.js

孤街醉人 提交于 2019-12-05 00:08:13
问题 For those that don't know, Processing is a great Java library =for rendering nice visualizations of data and serves as a wrapper for JOGL. Processing.js is the Javascript port of this library. In order to create a processing applet inside HTML, you need 3 things. processing.js anything.html anything.pde // Processing program I'm basically trying out the js version and the problem is that if any libraries are included in the pde, it won't load inside the canvas. Here are 2 examples: This is an

Exporting a QuickTime movie with Ruby-Processing

懵懂的女人 提交于 2019-12-04 19:17:34
I'm using Ruby-Processing to make a Processing app. How do I export a QuickTime movie of my app? I've tried the following: load_library 'video' import 'processing.video.MovieMaker' def setup # stuff... @mm = MovieMaker.new(WIDTH, HEIGHT, "drawing.mov", 30, MovieMaker.H263, MovieMaker.HIGH) end def draw # stuff... @mm.add_frame end def mouse_pressed @mm.finish_movie end But this doesn't seem to work, and I get this error: java.lang.reflect.InvocationTargetException at java.awt.EventQueue.invokeAndWait(EventQueue.java:1078) at quicktime.QTSession.<clinit>(QTSession.java:94) at quicktime.util

Processing / C920 logitech capture frame rate video discourse

时间秒杀一切 提交于 2019-12-04 19:05:27
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" -[65] "name=HD Pro Webcam C920,size=1600x896,fps=5" -[66] "name=HD Pro Webcam C920,size=1600x896,fps=30"

How can I access the Kinect using Java?

匆匆过客 提交于 2019-12-04 18:20:03
问题 I am currently in a Computer Vision course and for my final project I am going to make a small game that interacts with the Kinect. Now I want to make this game in Java as I have never really ventured into making a game before and I am very comfortable with the Language. But I cannot seem to find a way to just access the Depth data (I just need to pack it into some Java Data structure) and the RGB data (same idea). Right now, I have a way to 'talk' to the Kinect. I followed this tutorial and

How to enable VSync synchronization in processing 2.x?

南楼画角 提交于 2019-12-04 16:57:23
Previously, in processing 1.x, I used the following code to enable VSync synchronization: void enableVSync() { frameRate(-1); GL pgl = (PGraphicsOpenGL)g; gl = pgl.beginGL(); gl.setSwapInterval(1); pgl.endGL(); } This does not work in processing 2.x and I can't seem to find out how or even if it is supposed to work in processing 2.x. Edit: By switching from size(500, 500); to size(500, 500, P2D); , it seems to help. It now looks like processing does all the drawing in a back buffer and switches it to the front buffer at the VSync. However, the draw() function is still asynchronous with the

(using processing library in Eclipse) how do I use window mode?

隐身守侯 提交于 2019-12-04 14:48:07
http://processing.org/learning/eclipse/ according step 5, I used PApplet.main( new String[] { "--present", "MyGame" }); in my Main method. The game is in full screen mode, how do I switch to window mode? (I don't want to just run it as Java Applet...) Thanks If you don't want to use window mode, simply don't pass the argument: PApplet.main(new String[] {"MyGame"}); If you want to switch from present mode to window mode, you'll need to handle things manually AFAIK. PApplet extends java's Applet class and uses a Frame to add contents into. Here's a quick hack: import processing.core.PApplet;

Moving Processing project into Eclipse

喜欢而已 提交于 2019-12-04 14:04:26
I've been working on a Processing project for a while, and now want to move it into Eclipse. I've installed Proclipse with my Eclipse environment. I've a lot of files with the extension of ".pde". However the Proclipse files all ends with ".java". And there's a lot of dependency issues with all the pde files. How should I convert my project? =============== Thanks everyone! There doesn't seem to be a one-button solution, I refactored all the code following an approach similar to George's answer. Plus changing all the file extensions from ".pde" to ".java". Jose's advice is pretty good.