Hello, I did some searching on this and I'm still a little puzzled.
I wrote something that translates to the center of the screen rotates about 3 axes, then paints a rectangular panel in 3D space. I wanted to move this work inside a class that takes care of itself, which seemed to work until I moved the translate() statement inside the class.
The old draw loop in the main class:
I wrote something that translates to the center of the screen rotates about 3 axes, then paints a rectangular panel in 3D space. I wanted to move this work inside a class that takes care of itself, which seemed to work until I moved the translate() statement inside the class.
The old draw loop in the main class:
- void draw(){
background(0);
pushMatrix();
translate(width / 2, height / 2, 100); // move to middle of screen
myPanel.set_bearing(new float[] {PI * i / 30,PI * i / 30,PI * i / 30});
myPanel.paint();
popMatrix();
i++;
}
- myPanel = new QuadForm(width / 2, height / 2, 100);
- void paint(){
fill(shapeColor);
translate(cX, cY, cZ); // moving translate to QF causes failure to display
rotateY(bearing[0]); // Transfer rotations to QF, no error
rotateX(bearing[1]);
rotateZ(bearing[2]);
beginShape(QUADS);
for(int i = 0; i < template.length; i++){
vertex(template[i][0], template[i][1], template[i][2]);
}
endShape();
}
}
2