Java Code Examples for processing.core.PGraphics#endDraw()

The following examples show how to use processing.core.PGraphics#endDraw() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BiglyText.java    From haxademic with MIT License 6 votes vote down vote up
public void drawGraphics( PGraphics pg ) {
//		if(p.frameCount == 1) p.background(255);
		pg.beginDraw();
		pg.clear();

//		pg.background(255);
		pg.noStroke();
		
		float frameRadians = PConstants.TWO_PI / _frames;
		float percentComplete = ((float)(p.frameCount%_frames)/_frames);
		float progressRads = percentComplete * P.TWO_PI;
		float easedPercent = Penner.easeInOutQuart(percentComplete, 0, 1, 1);

		
		// Bread!
		pg.translate(p.width/2, p.height/2);
		PG.setDrawCenter(pg);
		PG.setPImageAlpha(pg, 0.3f);
		pg.scale(0.9f + P.sin(progressRads) * 0.1f);
		pg.rotate(0.01f * P.sin(P.PI/2 + progressRads));
		pg.image(biglyImg, 0, 0);

		pg.endDraw();
	}
 
Example 2
Source File: Silhouect.java    From haxademic with MIT License 6 votes vote down vote up
protected void storeUserFrame() {
	if(noUser == false && flashFrame == true) {
		// if user, add a frame to the array
		if(lastUserBuffer.size() < USER_HISTORY_SIZE) {
			PGraphics newUserBuffer = p.createGraphics(userBuffer.width, userBuffer.height, PRenderers.P2D); 
			if(lastUserBuffer.size() == 0) slideshow.add(newUserBuffer);	// add a single PGraphics to end of slideshow array
			lastUserBuffer.add(newUserBuffer);
			userHistoryStorageIndex = lastUserBuffer.size() - 1;
		} else {
			userHistoryStorageIndex++;
			if(userHistoryStorageIndex >= lastUserBuffer.size()) userHistoryStorageIndex = 0;
		}
		
		// draw current frame to oldest buffer
		PGraphics oldBuffer = lastUserBuffer.get(userHistoryStorageIndex);
		oldBuffer.beginDraw();
		oldBuffer.clear();
		oldBuffer.copy(userBuffer, 0, 0, userBuffer.width, userBuffer.height, 0, 0, oldBuffer.width, oldBuffer.height);
		oldBuffer.endDraw();
	}
}
 
Example 3
Source File: HaiBlobsSSAO.java    From haxademic with MIT License 6 votes vote down vote up
protected void builtGradientTextureLoop() {
	int textureW = p.width * 1;
	int textureH = p.height;
	int gradientW = textureW / 4;
	PGraphics img = p.createGraphics(textureW, textureH, P.P2D);
	img.smooth(8);
	tickerFXBuffer = p.createGraphics(textureW, textureH, P.P2D);
	tickerFXBuffer.smooth(8);
	img.beginDraw();
	img.noStroke();
	img.translate(gradientW / 2, textureH/2);
	Gradients.linear(img, gradientW, textureH, COLOR_1, COLOR_3);
	img.translate(gradientW, 0);
	Gradients.linear(img, gradientW, textureH, COLOR_3, COLOR_2);
	img.translate(gradientW, 0);
	Gradients.linear(img, gradientW, textureH, COLOR_2, COLOR_4);
	img.translate(gradientW, 0);
	Gradients.linear(img, gradientW, textureH, COLOR_4, COLOR_1);
	img.endDraw();
	BlurHFilter.instance(p).setBlurByPercent(0.5f, img.width);
	BlurHFilter.instance(p).setBlurByPercent(0.5f, img.width);
	BlurHFilter.instance(p).setBlurByPercent(0.5f, img.width);
	BlurHFilter.instance(p).setBlurByPercent(0.5f, img.width);
	
	ticker = new TickerScroller(img, p.color(255), textureW, textureH, (float)textureW / (float)_frames);
}
 
Example 4
Source File: Utility.java    From Project-16x16 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Rotates a PImage object by a given angle in radians.
 *
 * @param img PImage image to rotate.
 * @param angle Angle in radians.
 * @return new PImage object transformed.
 */
public static PImage rotateImage(PImage img, float angle) {
	PGraphics pg = applet.createGraphics((int) (img.width * 1.5), (int) (img.height * 1.5));

	pg.beginDraw();
	pg.clear();
	pg.imageMode(PApplet.CENTER);
	pg.translate(pg.width / 2, pg.height / 2);
	pg.rotate(angle);
	pg.image(img, 0, 0);
	pg.endDraw();

	return pg;
}
 
Example 5
Source File: BloomFilter.java    From haxademic with MIT License 5 votes vote down vote up
public void applyTo(PGraphics pg) {
		// lazy-init buffer per passed-in buffer
		if(buffers.containsKey(pg) == false) {
			buffers.put(pg, PG.newPG(pg.width, pg.height));
		}
		PGraphics glowTexture = buffers.get(pg);
//		DebugView.setTexture(glowTexture);
		
		// copy image & create glow version
		glowTexture.beginDraw();
//		glowTexture.clear();
		glowTexture.background(0);
////		glowTexture.image(pg, 0, 0);
		glowTexture.endDraw();
		ImageUtil.copyImage(pg, glowTexture);
		LeaveWhiteFilter.instance(P.p).setCrossfade(0.95f);
		LeaveWhiteFilter.instance(P.p).applyTo(glowTexture);
		BlurHFilter.instance(P.p).setBlurByPercent(strength, glowTexture.width);
		BlurVFilter.instance(P.p).setBlurByPercent(strength, glowTexture.height);
		for (int i = 0; i < iterations; i++) {
			BlurHFilter.instance(P.p).applyTo(glowTexture);
			BlurVFilter.instance(P.p).applyTo(glowTexture);
		}
		
		// blend it
		if(blendMode == BLEND_SCREEN) {
			BlendTextureScreen.instance(P.p).setSourceTexture(glowTexture);
			BlendTextureScreen.instance(P.p).applyTo(pg);
		} else if(blendMode == BLEND_MULTIPLY) {
			BlendTextureMultiply.instance(P.p).setSourceTexture(glowTexture);
			BlendTextureMultiply.instance(P.p).applyTo(pg);
		} else if(blendMode == BLEND_DARKEST) {
			BlendTextureDarken.instance(P.p).setSourceTexture(glowTexture);
			BlendTextureDarken.instance(P.p).applyTo(pg);
		}
	}
 
Example 6
Source File: AudioIn.java    From haxademic with MIT License 5 votes vote down vote up
protected void updateAudioData() {
		// only draw if debugging
		PGraphics audioBuffer = (P.isHaxApp() && DebugView.active() == true) ? audioInputDebugBuffer : null;
		// set up context
		if(audioBuffer != null) {
			audioBuffer.beginDraw();
			audioBuffer.background(0);
		}
		// update actual audio data and draw if we have a buffer passed in
		audioInput.update(audioBuffer);
//		audioData = audioInput.audioData();
		// close context
		if(audioBuffer != null) audioBuffer.endDraw();
	}
 
Example 7
Source File: PG.java    From haxademic with MIT License 5 votes vote down vote up
public static PGraphics newPG2DFast(int w, int h) {
		PGraphics newPG = P.p.createGraphics(w, h, PRenderers.P2D);
//		newPG.noSmooth();
	    ((PGraphicsOpenGL)newPG).textureSampling(2);
		newPG.beginDraw();
		newPG.background(0, 0);
		newPG.noStroke();
//		newPG.hint(PConstants.DISABLE_DEPTH_SORT);
//		newPG.hint(PConstants.DISABLE_DEPTH_TEST);
//		newPG.hint(PConstants.DISABLE_DEPTH_MASK);
		newPG.endDraw();
		PG.setTextureRepeat(newPG, false);
		return newPG;
	}
 
Example 8
Source File: ImageUtil.java    From haxademic with MIT License 5 votes vote down vote up
public static PImage imageToImageWithPadding(PImage img, float scaleCanvasUp) {
	PGraphics pg = P.p.createGraphics(P.ceil((float) img.width * scaleCanvasUp), P.ceil((float) img.height * scaleCanvasUp));
	pg.beginDraw();
	PG.setDrawCenter(pg);
	pg.clear();
	pg.translate(pg.width/2, pg.height/2);
	pg.image(img, 0, 0);
	pg.endDraw();
	return pg.copy();
}
 
Example 9
Source File: Demo_MaskConcentric.java    From haxademic with MIT License 5 votes vote down vote up
public void updateMaskedImages(PImage source) {
	for (int i = 0; i < numCircles; i++) {
		PGraphics image = images[i];
		image.beginDraw();
		image.background(255);
		image.noStroke();
		image.fill(255);
		ImageUtil.drawImageCropFill(source, image, true);
		image.endDraw();
		image.mask(masks[i]);
		// if(i < 4) DebugView.setTexture("image-"+i, image);
	}
}
 
Example 10
Source File: ImageUtil.java    From haxademic with MIT License 5 votes vote down vote up
public static void drawImageCropFill(PImage img, PGraphics dest, boolean cropFill, boolean rotate180, boolean openDestContext) {
	float ratioW = MathUtil.scaleToTarget(img.width, dest.width);
	float ratioH = MathUtil.scaleToTarget(img.height, dest.height);
	float scale = (ratioH < ratioW) ? ratioH : ratioW;			// letterbox
	if(cropFill) scale = (ratioH > ratioW) ? ratioH : ratioW;		// crop fill
	if(openDestContext) dest.beginDraw();
	dest.pushMatrix();
	PG.setDrawCenter(dest);
	dest.translate(dest.width/2, dest.height/2);
	if(rotate180) dest.rotate(P.PI);
	dest.image(img, 0, 0, img.width * scale, img.height * scale);
	PG.setDrawCorner(dest);
	dest.popMatrix();
	if(openDestContext) dest.endDraw();
}
 
Example 11
Source File: PG.java    From haxademic with MIT License 5 votes vote down vote up
public static void drawRainbow(PGraphics pg) {
	int colors[] = ColorsHax.PRIDE;
	pg.beginDraw();
	pg.noStroke();
	float colorHeight = P.round(pg.height / colors.length);
	for (int i = 0; i < colors.length; i++) {
		pg.fill(colors[i]);
		pg.rect(0, colorHeight * i, pg.width, colorHeight);
	}
	pg.endDraw();
}
 
Example 12
Source File: ImageUtil.java    From haxademic with MIT License 5 votes vote down vote up
public static PGraphics shapeToGraphics(PShape shape, float scale, int bgColor) {
	PGraphics pg = P.p.createGraphics(P.ceil((float) shape.width * scale), P.ceil((float) shape.height * scale));
	pg.beginDraw();
	if(bgColor != -999) pg.background(bgColor);
	pg.shape(shape, 0, 0, pg.width, pg.height);
	pg.endDraw();
	return pg;
}
 
Example 13
Source File: Demo_Shapes_drawDisc2.java    From haxademic with MIT License 5 votes vote down vote up
protected void drawGraphicsNative( PGraphics pg ) {
		PG.setDrawCenter(pg);
		pg.beginDraw();
		pg.clear();
		PG.setBasicLights(pg);
		
		float frameRadians = P.TWO_PI / _frames;
		float percentComplete = ((float)(p.frameCount%_frames)/_frames);
		float radiansComplete = P.TWO_PI * percentComplete;
		float easedPercent = Penner.easeInOutCubic(percentComplete);
		float easedPercentHard = Penner.easeInOutQuad(percentComplete);

//		pg.background(0);
		pg.translate(p.width/2, p.height/2 + p.height * 0.04f);
		pg.blendMode(P.SCREEN);
//		pg.blendMode(P.MULTIPLY);

//		pg.rotateY(p.mouseX * 0.01f);
//		pg.rotateX(p.mouseY * 0.01f);
		pg.rotateX(4.3f + 0.01f * P.sin(percentComplete * P.TWO_PI));
//		pg.rotateX(4.3f);
		
		pg.noStroke();
		
		int numDiscs = 25;
		float spacing = p.width * 0.019f;
		pg.translate(0, 0, spacing * numDiscs * 0.3f);
		for (int i = 0; i < numDiscs; i++) {			
			float percentDone = percentComplete + ((float)i/numDiscs);
			float size = p.width * 0.3f + p.width * 0.01f * P.sin(percentDone * P.TWO_PI);
			int discColor = p.color(200 + (i*5), 100 + (i*5), 170 - (i*5), 60);
			pg.fill(discColor);

			pg.translate(0,0,-spacing);
//			Shapes.drawDisc3D(pg, size, size * 0.9f - size * (P.sin(percentDone * P.TWO_PI)+1) * 0.15f, spacing, 40, discColor, discColor);
			Shapes.drawDisc(pg, size, size * 0.9f - size * (P.sin(percentDone * P.TWO_PI)+1) * 0.15f, 6); 
		}
		
		pg.endDraw();
	}
 
Example 14
Source File: SavedPointUI.java    From haxademic with MIT License 5 votes vote down vote up
public void drawDebug(PGraphics pg, boolean offscreen) {
	if(isShowing())  {
		if(offscreen) pg.beginDraw();
		drawPoint(pg);
		if(offscreen) pg.endDraw();
	}
}
 
Example 15
Source File: ImageUtil.java    From haxademic with MIT License 4 votes vote down vote up
public static PGraphics imageToGraphicsCropFill(PImage img, PGraphics pg) {
	pg.beginDraw();
	ImageUtil.cropFillCopyImage(img, pg, true);
	pg.endDraw();
	return pg;
}
 
Example 16
Source File: BezierSurface.java    From sketch-mapper with MIT License 4 votes vote down vote up
/**
 * Renders the grid in the surface. (useful in calibration mode)
 *
 * @param g
 */
private void renderGrid(PGraphics g) {
    g.beginDraw();


    g.fill(ccolor);

    g.noStroke();
    for (int i = 0; i < GRID_RESOLUTION; i++) {
        for (int j = 0; j < GRID_RESOLUTION; j++) {

            g.beginShape();
            g.vertex(vertexPoints[i][j].x, vertexPoints[i][j].y);
            g.vertex(vertexPoints[i + 1][j].x, vertexPoints[i + 1][j].y);
            g.vertex(vertexPoints[i + 1][j + 1].x, vertexPoints[i + 1][j + 1].y);
            g.vertex(vertexPoints[i][j + 1].x, vertexPoints[i][j + 1].y);
            g.endShape();

        }
    }

    g.textFont(sm.getIdFont());
    g.fill(255);
    g.textAlign(PApplet.CENTER, PApplet.CENTER);
    g.textSize(20);
    g.text("" + this.getSurfaceName(), (float) (this.getCenter().x), (float) this.getCenter().y);
    if (isLocked) {
        g.textSize(12);
        g.text("Surface locked", (float) this.getCenter().x, (float) this.getCenter().y + 26);
    }
    if (sketch != null) {
        g.textSize(10);
        g.text(sketch.getName(), (float) this.getCenter().x, (float) this.getCenter().y + 40);
    }


    g.noFill();
    g.stroke(BezierSurface.GRID_LINE_COLOR);
    g.strokeWeight(2);
    if (isSelected)
        g.stroke(BezierSurface.GRID_LINE_SELECTED_COLOR);

    if (!isLocked) {
        for (int i = 0; i <= GRID_RESOLUTION; i++) {
            for (int j = 0; j <= GRID_RESOLUTION; j++) {
                g.point(vertexPoints[i][j].x, vertexPoints[i][j].y, vertexPoints[i][j].z);
            }
        }
    }

    if (isSelected) {
        g.strokeWeight(4);
        g.stroke(BezierSurface.GRID_LINE_SELECTED_COLOR);

        //draw the outline here
        for (int i = 0; i < poly.npoints - 1; i++) {
            g.line(poly.xpoints[i], poly.ypoints[i], poly.xpoints[i + 1], poly.ypoints[i + 1]);
            if (i == poly.npoints - 2)
                g.line(poly.xpoints[i + 1], poly.ypoints[i + 1], poly.xpoints[0], poly.ypoints[0]);
        }
    }

    g.strokeWeight(1);
    g.stroke(SELECTED_OUTLINE_INNER_COLOR);
    //draw the outline here
    for (int i = 0; i < poly.npoints - 1; i++) {
        g.line(poly.xpoints[i], poly.ypoints[i], poly.xpoints[i + 1], poly.ypoints[i + 1]);
        if (i == poly.npoints - 2)
            g.line(poly.xpoints[i + 1], poly.ypoints[i + 1], poly.xpoints[0], poly.ypoints[0]);
    }


    if (!isLocked) {
        // Draw the control points.
        for (int i = 0; i < this.cornerPoints.length; i++) {
            this.renderCornerPoint(g, this.cornerPoints[i].x, this.cornerPoints[i].y, (this.activePoint == i), i);

        }

        for (int i = 0; i < this.bezierPoints.length; i++) {
            this.renderBezierPoint(g, this.bezierPoints[i].x, this.bezierPoints[i].y, (this.selectedBezierControl == i), i);
            g.strokeWeight(1);
            g.stroke(255);
            g.line(this.bezierPoints[i].x, this.bezierPoints[i].y, this.cornerPoints[(int) (i / 2)].x, this.cornerPoints[(int) (i / 2)].y);
        }

    }

    g.endDraw();
}
 
Example 17
Source File: Interphase.java    From haxademic with MIT License 4 votes vote down vote up
protected void drawSequencer(PGraphics pg) {
		float spacing = 40;
		float boxSize = 25;
		float startx = (spacing * sequencers.length) / -2f + boxSize/2;
		float startY = (spacing * NUM_STEPS) / -2f + boxSize/2;
		pg.beginDraw();
		PG.setCenterScreen(pg);
		PG.basicCameraFromMouse(pg, 0.1f);
		PG.setBetterLights(pg);
		PG.setDrawCenter(pg);
		
		// draw cubes
		for (int x = 0; x < sequencers.length; x++) {
			for (int y = 0; y < NUM_STEPS; y++) {
//				float value = (sequencers[x].stepActive(y)) ? 1 : 0; 
				boolean isOn = (sequencers[x].stepActive(y)); 
				pg.fill(isOn ? P.p.color(255) : 30);
				pg.pushMatrix();
				pg.translate(startx + x * spacing, startY + y * spacing);
				pg.box(20);
				pg.popMatrix();
			}
		}
		
		// show beat/4
		for (int y = 0; y < NUM_STEPS; y+=4) {
//			float value = (sequencers[x].stepActive(y)) ? 1 : 0; 
			pg.stroke(255);
			pg.noFill();
			pg.pushMatrix();
			pg.translate(-boxSize/2, startY + y * spacing);
			Shapes.drawDashedBox(pg, spacing * (sequencers.length + 1), boxSize, boxSize, 10, true);
			pg.popMatrix();
		}
		
		// track current beat
		int curBeat = P.store.getInt(BEAT) % NUM_STEPS;
		pg.stroke(255);
		pg.noFill();
		pg.pushMatrix();
		pg.translate(-boxSize/2, startY + curBeat * spacing);
		pg.box(spacing * (sequencers.length + 1), boxSize, boxSize);
		pg.popMatrix();	
		
		pg.endDraw();
	}
 
Example 18
Source File: GradientsBaseLayer2.java    From haxademic with MIT License 4 votes vote down vote up
protected void firstFrame() {
		int[] colors = new int[] {
				// superbowl: #0D131B
				ColorUtil.colorFromHex("#ff0D131B"),
				// team 1
//				ColorUtil.colorFromHex("#ff0B1630"),
//				ColorUtil.colorFromHex("#ffBB0022"),
//				ColorUtil.colorFromHex("#ff0B1630"),
//				ColorUtil.colorFromHex("#ffBB0022"),
				// team 2
//				ColorUtil.colorFromHex("#ff471D6C"),
//				ColorUtil.colorFromHex("#ffF5AB2C"),
//				ColorUtil.colorFromHex("#ff471D6C"),
//				ColorUtil.colorFromHex("#ffF5AB2C"),
				// team 3
				ColorUtil.colorFromHex("#ff9AAAA8"),
				ColorUtil.colorFromHex("#ff0E1210"),
				ColorUtil.colorFromHex("#ff9AAAA8"),
				ColorUtil.colorFromHex("#ff0E1210"),
//				// superbowl: #0D131B
				ColorUtil.colorFromHex("#ff0D131B"),
		};
		
		int gradientW = P.round(p.width * 0.25f);
		
		PGraphics img = p.createGraphics(gradientW * colors.length, p.height, P.P3D);
		img.smooth(8);
		
		img.beginDraw();
		img.noStroke();
		img.translate(gradientW/2, p.height/2);
		
		for (int i = 0; i < colors.length; i++) {
			Gradients.linear(img, gradientW, p.height, colors[i], colors[(i+1) % colors.length]);
			img.translate(gradientW, 0);
		}
		
		img.endDraw();
		
		// apply blur
		BlurHFilter.instance(p).setBlurByPercent(0.15f, img.width);
		for (int i = 0; i < 10; i++) BlurHFilter.instance(p).applyTo(img);
		
		// add to debug display
		DebugView.setTexture("gradient", img);
		
		// build ticker
		float tickerLoopSpeed = (float) img.width / (float) FRAMES;
		ticker = new TickerScroller(img, p.color(255), gradientW, p.height, tickerLoopSpeed);
	}
 
Example 19
Source File: SurfaceMapper.java    From sketch-mapper with MIT License 4 votes vote down vote up
/**
 * Render method used when calibrating. Shouldn't be used for final rendering.
 *
 * @param glos
 */
public void render(PGraphics glos) {
    //        glos.beginDraw();
    //        glos.endDraw();
    if (MODE == MODE_CALIBRATE) {
        parent.cursor();
        glos.beginDraw();

        if (this.isUsingBackground()) {
            glos.image(backgroundTexture, 0, 0, width, height);
        }

        glos.fill(0, 40);
        glos.noStroke();
        glos.rect(-2, -2, width + 4, height + 4);
        glos.stroke(255, 255, 255, 40);
        glos.strokeWeight(1);
        /*
         * float gridRes = 32.0f;
*
* float step = (float) (width / gridRes);
*
* for (float i = 1; i < width; i += step) { glos.line(i, 0, i, parent.height); }
*
* step = (float) (height / gridRes);
*
* for (float i = 1; i < width; i += step) { glos.line(0, i, parent.width, i); }
*/
        glos.stroke(255);
        glos.strokeWeight(2);
        glos.line(1, 1, width - 1, 1);
        glos.line(width - 1, 1, width - 1, height - 1);
        glos.line(1, height - 1, width - 1, height - 1);
        glos.line(1, 1, 1, height - 1);
        glos.endDraw();

        for (int i = 0; i < surfaces.size(); i++) {
            surfaces.get(i).render(glos);
        }

        // Draw circles for SelectionDistance or SnapDistance (snap if CMD
        // is down)
        glos.beginDraw();
        if (enableSelectionMouse) {
            if (!ctrlDown) {
                glos.ellipseMode(PApplet.CENTER);
                glos.fill(this.getSelectionMouseColor(), 100);
                glos.noStroke();
                glos.ellipse(parent.mouseX, parent.mouseY, this.getSelectionDistance() * 2, this.getSelectionDistance() * 2);
            } else {
                glos.ellipseMode(PApplet.CENTER);
                glos.fill(255, 0, 0, 100);
                glos.noStroke();
                glos.ellipse(parent.mouseX, parent.mouseY, this.getSnapDistance() * 2, this.getSnapDistance() * 2);
            }
        }

        if (selectionTool != null && !disableSelectionTool) {
            glos.stroke(255, 100);
            glos.strokeWeight(1);
            glos.fill(0, 200, 255, 50);
            glos.rect(selectionTool.x, selectionTool.y, selectionTool.width, selectionTool.height);
            glos.noStroke();
        }

        glos.endDraw();

    } else {
        parent.noCursor();
    }
}
 
Example 20
Source File: Silhouect.java    From haxademic with MIT License 4 votes vote down vote up
protected void firstFrame() {
		// main buffer
		float scaleDown = 0.75f;
		mainBuffer = p.createGraphics(P.round(1920 * scaleDown), P.round(1080 * scaleDown), PRenderers.P3D);
//		mainBuffer.noSmooth();
		rdBuffer = p.createGraphics(P.round(1920 * scaleDown), P.round(1080 * scaleDown), PRenderers.P3D);
//		rdBuffer.noSmooth();
		keystone = new PGraphicsKeystone(p, mainBuffer, 10, FileUtil.getPath("text/keystoning/silhouect.txt"));
		
		// init kinect
		if(P.platform == P.MACOSX) {
			kinect = new KinectPV2(p);
//			kinect.enableDepthImg(true);
//			kinect.enableDepthMaskImg(true);
			kinect.enableBodyTrackImg(true);
//			kinect.enableInfraredImg(true);
			// kinect.enableColorImg(true);
			kinect.init();
		}
		
		// init instructions/slideshow
		String imagesPath = FileUtil.getPath("images/silhouect/slideshow");
		ArrayList<String> files = FileUtil.getFilesInDirOfTypes(imagesPath, "png,jpg");
		slideshow = new ArrayList<PGraphics>();
		for (int i = 0; i < files.size(); i++) {
			P.println("Loaded image:", i, files.get(i));
			String filePath = files.get(i);
			PImage imgSrc = p.loadImage(filePath);
			PGraphics image = ImageUtil.imageToGraphics(imgSrc);

			image.beginDraw();
			image.background(0, 0);
			image.image(imgSrc, 0, 0);
			image.endDraw();
			LeaveWhiteFilter.instance(p).applyTo(image);
			DebugView.setTexture("image", image);
			slideshow.add(image);
		}
		
		// load sponsor image if it exists
		String sponsorImgPath = FileUtil.getPath("images/silhouect/sponsor.png");
		if(FileUtil.fileExists(sponsorImgPath)) {
			sponsorImg = p.loadImage(sponsorImgPath);
		}
		
		// load audio texture
//		AudioLineIn.instance();
//		audioTextures = new BaseTexture[] {
//			new TextureOuterCube(mainBuffer.width/4, mainBuffer.height/4),
//			new TextureOuterSphere(mainBuffer.width/4, mainBuffer.height/4),
//			new TextureEQConcentricCircles(mainBuffer.width/4, mainBuffer.height/4),
//			new TextureLinesEQ(mainBuffer.width/4, mainBuffer.height/4),
//		};
		
		// init help menu
		DebugView.setHelpLine("Key Commands:", "");
		DebugView.setHelpLine("[R]", "Reset keystone");
		DebugView.setHelpLine("[D]", "Keystone test pattern");
	}