FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Bugs
   Bug Fixes, Implemented Suggestions
(Moderator: fry)
   exception with hint(SMOOTH_IMAGES)
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: exception with hint(SMOOTH_IMAGES)  (Read 301 times)
arielm

WWW
exception with hint(SMOOTH_IMAGES)
« on: Jun 1st, 2003, 10:33am »

sometimes (tested with 0054), playing with texture mapping and using hint(SMOOTH_IMAGES) cause a
 
"ArrayIndexOutOfBoundsException at BPolygon.scanline"
 
 
this bug is hard to reproduce, but the following manage to do it:
 
Code:

BImage img;
 
float a = 0.0;
 
void setup()
{
  size(200, 200);
  hint(SMOOTH_IMAGES);
  fill(255);
   
  img = loadImage("paradis.jpg");  // 180 x 210
}
 
void loop()
{
  rotateY(a);
  a += radians(1.0);
 
  image(img, 0.0, 0.0, 90.0, 105.0, 0.0, 0.0, 179.0, 209.0);
}

 
the exception is occuring when the rotation angle is about 120 degrees, but with other "image" parameters, it can happen before...
 
 
n.b: i don't know if it's like this by design, but if i would have use 180.0 and 210.0 as the last 2 params of image() in loop(), this same exception would have occur from frame 0...
 

Ariel Malka | www.chronotext.org
arielm

WWW
Re: exception with hint(SMOOTH_IMAGES)
« Reply #1 on: Jun 2nd, 2003, 1:42am »

hey, it seems that my bug is related to this one:
http://proce55ing.net/discourse/yabb/board_Proce55ing_software__bugs_action_display_num_1053353579.html
 
even though, something like image(BImage, int , int) should not use texture-mapping if there weren't 3d manipulations before it ()
 

Ariel Malka | www.chronotext.org
arielm

WWW
Re: exception with hint(SMOOTH_IMAGES)
« Reply #2 on: Jun 2nd, 2003, 9:59pm »

just a supposition why (smoothed) text is not affected by this bug:
 
could it be because each 64x64 font character bitmap have a huge pixels int[] of 64x64x4 instead of 64x64?
 
maybe as a temporary workaround, it could help to extend the size of the pixels array of BImages canditate to smoothed texture mapping (the question is how much to extend...)
 

Ariel Malka | www.chronotext.org
arielm

WWW
Re: exception with hint(SMOOTH_IMAGES)
« Reply #3 on: Jun 5th, 2003, 12:43pm »

okay, it seems that extending the pixels array of an image by 2 rows is a workaroung to this bug!
 
then, the following corrected code will work smoothly...
 
Code:

BImage img;
 
float a = 0.0;
 
void setup()
{
  size(200, 200);
  hint(SMOOTH_IMAGES);
  fill(255);
   
  img = loadImage("paradis.jpg");  // 180 x 210
 
  int n = 180 * 2;  // adding 2 "rows" to the image is enough...
  int temp[] = new int[img.pixels.length + n];  
  System.arraycopy(img.pixels, 0, temp, 0, img.pixels.length);  
  img.pixels = temp;
  // Q: should i trust java for correct garbage collecting here?
}
 
void loop()
{
  rotateY(a);
  a += radians(1.0);
 
  image(img, 0.0, 0.0, 90.0, 105.0, 0.0, 0.0, 180.0, 210.0);
}
 

Ariel Malka | www.chronotext.org
fry


WWW
Re: exception with hint(SMOOTH_IMAGES)
« Reply #4 on: Sep 18th, 2003, 4:30am »

finally found this one.. have fixed it many times now.. same four lines of code, but they've produced many bugs..
 
Pages: 1 

« Previous topic | Next topic »