just out of curiosity ...
how can i use rotateZ() of a PGraphics(-2,-3) object?
the only class that seems to have rotateZ() is PGraphics3 but using that just makes the sketch go blue ... ?
Code:
PImage img;
void setup() {
size(200,200, P3D);
img = loadImage("house.jpg");
}
float rotation = 0.0;
void draw (){
background(0);
image(rotateImage(img, rotation), 0, 0);
rotation += 0.02;
}
PImage rotateImage (PImage _img, float _rad)
{
int xm = _img.width;
int ym = _img.height;
if (_rad == 0) return _img;
PGraphics _bimg = new PGraphics(xm, ym, this);
_bimg.background(255);
_bimg.noStroke();
_bimg.translate(xm/2.0, ym/2.0);
_bimg.rotateZ(_rad); // <------------
_bimg.beginShape(QUADS);
_bimg.texture(img);
_bimg.vertex( -(xm/2), -(ym/2),0, 0,0);
_bimg.vertex( (xm/2), -(ym/2),0, xm,0);
_bimg.vertex( (xm/2), (ym/2),0, xm,ym);
_bimg.vertex( -(xm/2), (ym/2),0, 0,ym);
_bimg.endShape();
return (PImage) _bimg;
}
F