It works!
Mhhh ... gonna work on a sphere/cube with a texture made with particles animated by perlin noise.... will post back when finished.
Code:
import peasy.*;
import processing.opengl.*;
PGraphics tex;
PeasyCam pCamera;
int ty = 0;
void setup() {
size(300,300,OPENGL);
colorMode(HSB, 360, 100, 100);
tex = createGraphics(80, 80, P3D);
pCamera = new PeasyCam(this, 300);
}
void draw() {
background(0, 0, 0);
scale(60);
TexturedCube(tex);
tex.beginDraw();
tex.background(102);
tex.stroke(255);
tex.line(40, 40, 40, ty);
tex.endDraw();
ty += 1;
if(ty > 50) ty = 0;
}
void TexturedCube(PGraphics tex) {
noFill();
stroke(1, 100, 100);
strokeWeight(1.5);
beginShape(QUADS);
texture(tex);
textureMode(NORMALIZED);
vertex(-1, 1, 1, 0, 0);
vertex( 1, 1, 1, 1, 0);
vertex( 1, -1, 1, 1, 1);
vertex(-1, -1, 1, 0, 1);
vertex( 1, 1, 1, 0, 0);
vertex( 1, 1, -1, 1, 0);
vertex( 1, -1, -1, 1, 1);
vertex( 1, -1, 1, 0, 1);
vertex( 1, 1, -1, 0, 0);
vertex(-1, 1, -1, 1, 0);
vertex(-1, -1, -1, 1, 1);
vertex( 1, -1, -1, 0, 1);
vertex(-1, 1, -1, 0, 0);
vertex(-1, 1, 1, 1, 0);
vertex(-1, -1, 1, 1, 1);
vertex(-1, -1, -1, 0, 1);
vertex(-1, 1, -1, 0, 0);
vertex( 1, 1, -1, 1, 0);
vertex( 1, 1, 1, 1, 1);
vertex(-1, 1, 1, 0, 1);
vertex(-1, -1, -1, 0, 0);
vertex( 1, -1, -1, 1, 0);
vertex( 1, -1, 1, 1, 1);
vertex(-1, -1, 1, 0, 1);
endShape();
}