Keystone + GLGraphics + Toxiclibs
in
Contributed Library Questions
•
1 year ago
Hey there!
I am creating a scene for a projection mapping work.
Some .stl models have to be loaded, then i have to be able to map and project it on to a surfacer.
I'm using the keystonep5 library and GLGraphics for the mapping.
And I'm using the toxiclibs library to generate the meshes.
The problem is that if I'm "feeding" everything into the GLGraphicsOffScreen to be able to keystone it, after render there are no lights / shadows, and the model also have a draft wireframe look.
Do you know what I'm doing wrong?
I'm not a processing expert, so any thoughts would be highly appreciated:)
Thanks!
Here's my code:
- import toxi.geom.*;
- import toxi.geom.mesh.*;
- import toxi.processing.*;
- import processing.opengl.*;
- import codeanticode.glgraphics.*;
- import deadpixel.keystone.*;
- TriangleMesh mesh;
- ToxiclibsSupport gfx;
- GLGraphicsOffScreen offscreen;
- Keystone ks;
- CornerPinSurface surface;
- //...
- void setup() {
- size(800, 600, GLConstants.GLGRAPHICS);
- mesh = (WETriangleMesh) new STLReader().loadBinary(sketchPath("stage.stl"), STLReader.WEMESH);
- gfx=new ToxiclibsSupport(this);
- Vec3D centerpos = new Vec3D(width/2, height/2, 0);
- mesh.rotateX(PI/2);
- mesh.rotateY(PI);
- mesh.scale(2.5);
- mesh.translate(centerpos);
- offscreen = new GLGraphicsOffScreen(this, width, height);
- ks = new Keystone(this);
- surface = ks.createCornerPinSurface(width, height, 20);
- }
- void draw() {
- PVector mouse = surface.getTransformedMouse();
- gfx.origin(new Vec3D(),200);
- offscreen.beginDraw();
- offscreen.background(0);
- offscreen.lights();
- offscreen.noStroke();
- gfx.mesh(mesh,false,0);
- offscreen.endDraw();
- background(0);
- surface.render(offscreen.getTexture());
- }
- void keyPressed() {
- switch(key) {
- case 'c':
- ks.toggleCalibration();
- break;
- }
- }
1