2010-01-31

ProjectedQuads source code

,Projected Quads

On request from several people I decided to finally release source code of my projection mapping projects. I wanted to make a Processing library from it anyway at some point but I delayed it so many times that it might never happen. Meet "Projected quads":

Features

Download

ProjectedQuadsTest.zip [7kb]

How to use it?

Let's say we want to display an image with perspective correction. First declare variables for our image and quad that will display it.

PImage    img;
ProjectedQuads projectedQuads;

Then in setup() function load the image, create projectedQuads object, set number of quads and assign textures to them.

void setup() {
    img = loadImage("checker.png");
    projectedQuads = new ProjectedQuads();
    projectedQuads-setNumQuads(1);
    projectedQuads.getQuad(0).setTexture(img);
}

All we have to do in draw() function is just call projectedQuads.draw();

void draw() {
    projectedQuads.draw();
}

Run the sketch and adjust corners of the quad using mouse or keyboard. Attached example source code explains how to use more quads and display dynamic graphic generated in processing.

Some other projects that I use this code for:

3xI

Reactive projection mapping during Vivisesja festival.

,3xI

Shiftcontrol's end of the year

During Christmass meeting I did small projections to add some life to the globetrotters pub where it took place.

!VIMEO,8237461,640,480
!VIMEO,8237588,640,480