When running a simple sketch with a sphere in a browser the web console kicks out this message:
"[17:06:39.457] Error: WebGL: Drawing without vertex attrib 0 array enabled forces the browser to do expensive emulation work when running on desktop OpenGL platforms, for example on Mac. It is preferable to always draw with vertex attrib 0 array enabled, by using bindAttribLocation to bind some always-used attribute to location 0. @
http://127.0.0.1:61971/processing.js:5274"
It renders fine, but is there something I should be setting that I'm not?
I'm building a project in Processing 2.09b, and it exports fine, however, people multiple with Mountain Lion cannot open the application file. I made a "hello world" sketch and had the same problem. Is there an easy workaround?
I am running this code on the Galaxy Tab 2. It shows an image, but I would like a live video and the image stops updating after a second. If anyone can see something obvious that I'm missing I'd be much obliged.
import ketai.camera.*; KetaiCamera cam;
void setup() { orientation(LANDSCAPE); cam = new KetaiCamera(this, 320, 240, 24); // int camnum = cam.getNumberOfCameras(); cam.setCameraID(1);// changes the camera to the front. cam.start(); }
void draw() { }
void onCameraPreviewEvent() { cam.read(); cam.loadPixels(); image(cam, 0, 0, 320, 240); // Draw the webcam video onto the screen println("previewing"); }
The apWidget video example is not working with android 4.0 on my galaxy 2 tablet. The file's audio plays but there is no video. Anyone have a work around, or another method for showing video?
I'm having a dickens of a time getting a spotlight to orient the same direction as the camera. I'm using the OCD library and want the spotlight to act as a headlight as we move and turn through the space. Any help at this point would be greatly appreciated. I've included some rough code below.
w- forward
s - back
a - slide right
d - slide left
j - turn left
k - turn right
I've finally got a ball line collision solution I like. I'm always in a position of wanting to know if a ball is touching a line and/or if a ball has crossed a line. Props to Jeanine Meyer for some of the math help.
int xStart = 50;
int yStart = 50;
int xEnd = 300;
int yEnd = 300;
int xBall = 20;
int yBall = 20;
int balldiameter = 20;
int oldxball, oldyball;
boolean crossOverLine (float px, float py,float qx,float qy,float ax,float ay,float bx,float by) {
float s,t, w1,w2,w3,w4,w5,w6;
w1=ax*(qy-py);
w2 = (bx-ax)*(qy-py);
w3 = px*(qy-py);
w4= (qx-px)*ay;
w5= (by-ay)*(qx-px);
w6= py*(qx-px);
if (w2==w5) {
return false;
}
s = (w3-w1+w4-w6)/(w2-w5);
if (s<0) {
return false;
}
if (s>1) {
return false;
}
if (qx==px) {
return false;
}
t = (ax+s*(bx-ax)-px)/(qx-px);
if (t<0) {
return false;
}
if (t>1) {
return false;
}
return true;
}
boolean touchingLine (float px, float py, float qx, float qy, float cx, float cy, int rad ) {
float dx, dy, t, rt;
dx = qx-px;
dy = qy-py;
t =0.0-((px-cx)*dx+(py-cy)*dy)/((dx*dx)+(dy*dy));
if (t<0.0) {
t=0.0;
}
else if (t>1.0) {
t = 1.0;
}
//check if distance at this t is less than radius, actually compare squares
dx = (px+t*(qx-px))-cx;
dy = (py +t*(qy-py))-cy;
rt = (dx*dx) +(dy*dy);
if (rt<(rad*rad)) {
return true;
}
else {
return false;
}
}