Dear Mesa people,

I don't know whether this is a bug, but it certainly seems a little
strange (I use Mesa-3.0 on a Linux PPro, Redhat 6.0 system).

If I set up a 2D RGB grid and wish to scale this up with
gluScaleImage, I get some strange results if the dims of the input
data is not powers of 2.  Assume a 4x4 grid where the coloring of the
rows vary linearily from pure black (bottom row) to pure white (top
row).  So the RGB tripples at each row are
 
  0, 85, 170, 255

Now, I scale this 4x4 grid with gluScaleImage to a 16x16 grid and get 

  0, 17, 34, 51, 68, 85, 102, 119, 136, 153, 170, 187, 204, 221, 238, 255

for each of the rows, which is what you'd expect: a complete linear
variation through the grayscale colormap.  

If I instead of the 4x4 grid choose a 5x5 grid with the row coloring

  0, 63, 127, 191, 255

and input this to gluScaleImage for a 16x16 upscaling, I get a
completely different grid.  The coloring of each row is no longer
homogeneous and RGB values vary at each gridpoint (non-grayscale
colors start to appear).  For example for the last row I get 

R =  63, G =  63, B = 127
R =  80, G =  80, B = 144
R =  97, G =  97, B = 161
R = 114, G = 114, B = 178
R = 131, G = 131, B = 195
R = 148, G = 148, B = 212
R = 165, G = 165, B = 229
R = 182, G = 182, B = 246
R = 199, G = 199, B = 229
R = 216, G = 216, B = 178
R = 233, G = 233, B = 127
R = 250, G = 250, B =  76
R = 232, G = 214, B =  66
R = 203, G = 160, B =  69
R = 173, G = 106, B =  72
R = 144, G =  53, B =  76

Here's the chunk of c++ code I use:


     // fill data in to small grid
     GLsizei imax = 5;
     GLsizei jmax = 5;
     GLubyte *data = new GLubyte[3*imax*jmax];

     for (int i=0; i<imax; i++) {
       for (int j=0; j<jmax; j++) {
         GLubyte itmp = (GLubyte) ( 255.0*j/(jmax-1.0) );
         int p = 3*( i*jmax + j );

         data[p+0] = itmp;
         data[p+1] = itmp;
         data[p+2] = itmp;
       }
     }

     // define larger grid
     GLsizei smax = 16;
     GLsizei tmax = 16;
     GLubyte *scaled = new GLubyte[3*smax*tmax];

     // scale small grid to large grid
     gluScaleImage(GL_RGB,
                   imax, jmax,
                   GL_UNSIGNED_BYTE,
                   data,
                   smax, tmax,
                   GL_UNSIGNED_BYTE,
                   scaled);




_______________________________________________
Mesa-bug maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-bug


_______________________________________________
Mesa-dev maillist  -  [EMAIL PROTECTED]
http://lists.mesa3d.org/mailman/listinfo/mesa-dev

Reply via email to