Thanks for your response, I have looked into it, and maybe I am a bit too new for the domain, but I did not figure out exactly how this would help me achieve the desired effect. I see the code is indeed very effective, yet I could not quite derive how this would help me achieving the broken mirror effect I am trying to create.
I ham currently using a simple capture and transposing it into a gl texture.
following is a trifle code snippet which actually combines two examples (GS Capture with Image manipulation in opengl):
void setup() {
size(1296, 968,GLConstants.GLGRAPHICS);
frameRate(30);
cam = new GSCapture(this, 640, 480);
tex = new GLTexture(this,483,667);
initVideoModel();
cam.setPixelDest(tex);
cam.play();
beginTime=millis();
}
void initVideoModel(){
// The model is dynamic, which means that its coordinates can be
// updating during the drawing loop.
texquad = new GLModel(this, numPoints, QUADS, GLModel.DYNAMIC);
// Updating the vertices to their initial positions.
texquad.beginUpdateVertices();
texquad.updateVertex(0, 423, 161, 0);
texquad.updateVertex(1, 906, 161, 0);
texquad.updateVertex(2, 906, 828, 0);
texquad.updateVertex(3, 423, 828, 0);
texquad.endUpdateVertices();
image(tex, 423, 161, 483, 667);
// Enabling the use of texturing...
texquad.initTextures(1);
texquad.setTexture(0, tex);
// Setting the texture coordinates.
texquad.beginUpdateTexCoords(0);
texquad.updateTexCoord(0, 0, 0);
texquad.updateTexCoord(1, 1, 0);
texquad.updateTexCoord(2, 1, 1);
texquad.updateTexCoord(3, 0, 1);
texquad.endUpdateTexCoords();
// Enabling colors.
texquad.initColors();
texquad.beginUpdateColors();
for (int i = 0; i < numPoints; i++) {
texquad.updateColor(i, random(0, 255), random(0, 255), random(0, 255), 225);
}
texquad.endUpdateColors();
}
void captureEvent(GSCapture cam) {
if (cam.available() == true) {
cam.read();
}
}
void draw() {
if (tex.putPixelsIntoTexture()) {
GLGraphics renderer = (GLGraphics)g;
renderer.beginGL();
background(0);
// Randomizing the vertices.
texquad.beginUpdateVertices();
for (int i = 0; i < numPoints; i++) {
texquad.displaceVertex(i, random(-1.0, 1.0), random(-1.0, 1.0), random(-1.0, 1.0));
}
texquad.endUpdateVertices();
renderer.model(texquad);
renderer.endGL();
}
}
I want to figure out how to manipulate the texture (probably by putting it on some king of Model) so that i could "fracture" it and let pieces of it "fall" eventually.
even a simple example of just taking a video capture and splitting it into 2 or 4 would help. maybe pol2tri can help me in the splitting in a way a mirror would break?