Forums > Javascript

[jsui] Sketch.copypixels and FSAA

August 18, 2010 | 2:19 pm

I have an impression that Sketch.copypixels(…) copies twice as much with FSAA on. The effect is only apparent when copying a portion of source picture to an antialiased sketch (e.g. jsui’s own sketch).

I guess this is due to subsampling but then why it only affects width/height and not offset (either source or destination’s)?

I have very similar problem with Sketch.glscissor() which is supposed to work with window coordinates, but with FSAA on I have to double all the paramters (my solution is to use the following):

Sketch.prototype.glscissor_m = function(x,y,w,h) {
  if (this.fsaa)
    this.glscissor(2*x,2*y,2*w,2*h);
  else
    this.glscissor(x,y,w,h);
}

(I guess I need to make a similar "patch" for copypixels…)


August 18, 2010 | 2:22 pm

update:

Sketch.prototype.copypixels_m = function(src,dx,dy,sx,sy,w,h) {
  if (this.fsaa) { w /= 2; h /= 2; }
  this.copypixels(src,dx,dy,sx,sy,w,h);
}

I could also be more blunt and mask the original methods altogether, but I’m not so I don’t…


Viewing 2 posts - 1 through 2 (of 2 total)