processing

Video with alpha for Processing

北战南征 提交于 2019-12-24 17:07:55
问题 I am researching how to play alpha videos in processing to make augmented reality. What is the format and encoding needed to render video files with alpha channel? When I do this in Unity I use a special shader and video format so can use luma cut, whereas in the same video you put the white and black in one side (or up) and the color in the other side (or down), then the shader makes "the magic" and leaves the color over to cutted image. Here is a link to previous post: Video with alpha

Processing: View side of cube when pressing Key

こ雲淡風輕ζ 提交于 2019-12-24 16:46:12
问题 I have to view the side of the cube when pressing the key: • The user sees different views of the cube when presses the following keys: • The 1 key: the front view of the cube (red face) • The 2 key: the back view of the cube (yellow face) • The 3 key: the top view of the cube (blue face) • The 4 key: the bottom view of the cube (magenta face) • The 5 key: the right view of the cube (green face) • The 6 key: the left view of the cube (cyan face) I have the code. It works without the answer;

Disable close button in Processing

懵懂的女人 提交于 2019-12-24 13:16:34
问题 Is there a way to disable the window's close button in Processing, during a certain event? Here is a snippet of the code: frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { if (youWin == 0) // condition that is supposed to keep the application opened { JOptionPane.showMessageDialog(frame,"You can't exit until you finish this game. OK?"); // keep applet opened } } } ); EDIT: I want to do it without using JFrames. 回答1: Edit: This answer is for Processing 2

processing twitter4j no files added to sketch

喜你入骨 提交于 2019-12-24 11:43:38
问题 Im getting this error for processing, when I use Twitter4j 3 and processing 2. Ive tried browsing the error, but no one has resolved it. When ever I run my program for a period of time(30 seconds), it halts and gives this error. Im using the streaming API in my code. Im running processing on a MacOSX. EDIT**** Here is my code so far... void setup() { size(600, 600); smooth(); noStroke(); } void draw() { GetTweets(); } void method1() { System.out.println("method1 can be called and it works!!")

Create a grid in perspective from 4 corners

家住魔仙堡 提交于 2019-12-24 10:45:54
问题 I'm trying to generate a grid of points from its 4 corners. As this corners can be freely placed, it will look as the grid has a perspective. I've written the following code in Processing, where corners are in clockwise order (starting at top-left) PVector[][] setGrid(PVector[] corners, int cols, int rows) { PVector[][] grid = new PVector[rows][cols]; for(int y = 0; y < rows; y++) { float fY = (float)y / (rows - 1); PVector p1 = PVector.lerp(corners[0], corners[3], fY); PVector p2 = PVector

Image array p5.js

孤街浪徒 提交于 2019-12-24 07:26:00
问题 I've created some nested arrays to display array of Images, one thing I cant get right it repeats the same image instead of drawing a new one in every loop. here is my example code simulates my problem var images = []; function preload() { for (var i = 0; i< 3; i++) { images[i] = loadImage("img/img" + i + ".jpg"); } } function setup() { createCanvas(900, 900); background(0); preload(); } function draw() { //image(images[0],0,0); for ( var y= 0; y < height; y=y+300) { for ( var x =0; x < width

Processing Tower Defence Game - Towers attacking Enemies

自古美人都是妖i 提交于 2019-12-24 06:43:56
问题 I will keep this short, I am making a Tower Defence game as a mini project while I have some spare time and I am trying to figure out how I can implement the towers to be able to shoot the enimies when they come into range using dist but I just don't know how to implement a method that uses the enimies position and the towers position. I have an ArrayList of CreepSprites and Towers CreepSprite[] CreepSprites; ArrayList<Tower> AllTowers = new ArrayList<Tower>(); ArrayList<Creep> AllCreeps =

Assign states various values in Processing

浪子不回头ぞ 提交于 2019-12-24 03:46:28
问题 I am working on a tile based game, where various tiles have different states. I am now looking to add a player object, this object will continually check the states of the tiles in order to move. My Tile class: class Tile { int x, y; boolean empty = true; boolean baseCell = true; boolean active = false; public static final int EMPTY = 0; public static final int BASE = 1; public static final int ACTIVE = 2; Tile(int x_, int y_, boolean baseCell_) { x=x_; y=y_; baseCell=baseCell_; } void

p5.js collision/object interaction. Ball bounce

末鹿安然 提交于 2019-12-24 01:09:53
问题 Following the collision between a ball from an array and an object (rectangle), the ball doesn't seem to have the same bounce affect as it has when it hits the ground. When coming into contact with the object, it seems to pick up speed and suddenly glitches through and comes to rest on the ground. Questions: Why does it seem to want to rest on the ground and not on the object itself? How can I make the ball have the same bounce affect when coming into contact with the object as it has when

Processing OpenCV vs Open CV

僤鯓⒐⒋嵵緔 提交于 2019-12-23 19:23:52
问题 Solution: Start Processing 64 bit mode (Mac: in Preferences). Sketch/Import Library/Add Library (All the libraries are there: Thank you Processing Team !!!) Install what you want (I took Opencv for processing). Works. Enjoy :) Original Question: I have OpenCV installed on my system. Finally after a lot of fails and a complete new system install. Now I saw that there is this Processing OpenCV library: http://ubaa.net/shared/processing/opencv/ Which is awesome and it comes with a Mac installer