P3D Processing source code / help me

import java.io.FileOutputStream;

import peasy.*;

PeasyCam camera;
PShape s;
PGraphics pg;

void settings() {
size(1000, 1000, P3D);
PJOGL.setIcon(“icon.png”);
}

void setup() {

pg = createGraphics(400, 400, P3D);
s = loadShape(“Untitled2.obj”);
camera = new PeasyCam(this, pg, 200);
camera.setViewport(0, 0, 400, 400);
shapeMode(CENTER);
// pg.beginDraw(); pg.endDraw();
}

void draw() {

background(255);

pg.beginDraw();
pg.background(255);
pg.lights();
//pg.translate(pg.width/2, pg.height/2 + 100, -200);
//pg.rotateX(PI);
//pg.rotateY(frameCount * 0.01f);
pg.shape(s);
pg.endDraw();
image(pg, 0,0,400, 400);

}

Is it correct to do something like the source code above?

Or is there another way?

1 Like