colo(u)r depth 4.0b4 problems

Ellis Golub ellis "at" vesicle.dental.upenn.edu
Thu Jan 8 20:44:01 2004


Hi --

I am in the process of upgrading to VNC version 4, and have run into a problem
with colo(u)r depth.  I'm running the server on a Win XP box, and the viewers
on an SGI Tezro running IRIX 6.5.22

When I use a version 3 viewer, I get "truecolor" :

VNC server supports protocol version 3.3 (viewer 3.3)
VNC authentication succeeded
Desktop name "APATITE"
Connected to VNC server, using protocol version 3.3
VNC server default format:
  32 bits per pixel.
  Least significant byte first in each pixel.
  True colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
Using TrueColor visual, depth 12.  Pixel format:
  16 bits per pixel.
  Most significant byte first in each pixel.
  True colour: max red 15 green 15 blue 15, shift red 0 green 4 blue 8

When I run the version 4 viewer I get the folowing:

hu Jan  8 11:57:17 2004
 CConn:       connected to host apatite.dental.upenn.edu port 5900
 CConnection: Server supports RFB protocol version 3.7
 CConnection: Using RFB protocol version 3.7

Thu Jan  8 11:57:18 2004
 TXImage:     Using default colormap and visual, PseudoColor, depth 8.
 CConn:       Using pixel format depth 6 (8bpp) rgb222
 CConn:       Using ZRLE encoding
 CConn:       Throughput 20020 kbit/s - changing to hextile encoding
 CConn:       Throughput 20020 kbit/s - changing to full colour
 CConn:       Using pixel format depth 8 (8bpp) colour-map
 CConn:       Using hextile encoding

No command line setting seems able to alter the low pixel format.


vncviewers:
version 3: RealVNC 3.3.3r2, Tight VNC 1.2.5, Tight VNC 1.2.8 (SGI freeware)
version 4: RealVNC 4.0b4

All except the SGI freeware version were locally built.

Compilation of the version 4.0b4 code as written produces the following
compiler error:

c-1101 CC: ERROR File = TXImage.cxx, Line = 330
  "r" has already been declared in the current scope.

      for (int r = 0; r < cube->nRed; r++) {

The relevent code snippet from TXImage.cxx is:

    XColor xc[256];
    cube = new rfb::ColourCube(6,6,6);
<317>    for ( int r = 0; r < cube->nRed; r++) {
      for (int g = 0; g < cube->nGreen; g++) {
        for (int b = 0; b < cube->nBlue; b++) {
          int i = (r * cube->nGreen + g) * cube->nBlue + b;
          xc[i].red =   r * 65535 / (cube->nRed-1);
          xc[i].green = g * 65535 / (cube->nGreen-1);
          xc[i].blue =  b * 65535 / (cube->nBlue-1);
        }
      }
    }

    TXWindow::getColours(dpy, xc, cube->size());

<330>    for (int r = 0; r < cube->nRed; r++) {
      for (int g = 0; g < cube->nGreen; g++) {
        for (int b = 0; b < cube->nBlue; b++) {
          int i = (r * cube->nGreen + g) * cube->nBlue + b;
          cube->set(r, g, b, xc[i].pixel);
        }
      }
    }
  }
}



I've tried two fixes, both of which allow compilation to a working viewer, with
impaired color mapping:

1) for ( r = 0; r < cube->nRed; r++){

2) for (int rr = 0; rr < cube->nRed; rr++){  with rr substituted for r in the
rest of the routine.

One thing I don't understand is why only r is said to be twice declared, when g
and b are also declared in the XColor routine <line 317 ff>.

I'm sure to be missing something simple here, but I don't know what.


Ellis

--
=============================================================
Ellis Golub                  Phone: (215) 898-4629
Biochemistry Department      FAX:   (215) 898-3695
University of Pennsylvania   ellis "at" biochem.dental.upenn.edu
School of Dental Medicine
240 South 40th Street
Philadelphia, PA 19104-6030
Home: http://biochem.dental.upenn.edu/~ellis/
PGP: http://biochem.dental.upenn.edu/~ellis/public_key.html
==============================================================