Dongxiao, I'm afraid that the VNC List strips attachments, so I don't know what the colour problem you're seeing is, but one common bug in X rendering code is to assume that if the display is depth 24 that pixels are in RGB format. Current Xvnc releases use BGR by default, which leads to red & blue being swapped if applications mistakenly assume RGB.
Cheers, -- Wez @ RealVNC Ltd > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of ??? > Sent: 03 April 2008 09:45 > To: vnc-list@realvnc.com > Subject: Help about SDL abnormal color display in VNC viewer. > > Hi, all, > I wrote a very simple SDL drawing program under linux > (the code is in the first attachment), it just shows a color > (R=63, G=127, B=191) in a 320x240 panel. If I run the program > in X window, the color displays correct. But if I use VNC > viewer to connect the host and then run the program, the > color is abnormal, (see the second attached file, the left > part is the wrong displayed color, and the right part is the > correct color of R=63, G=127, B=191). Can someone help me > about this or is it a bug of VNC viewer? > Thanks very much! > > BTW: I am using VNC viewer free edition 4.1.1. Also I have > tried the latest version of VNC, this issue still exists. > > Best regards, > Xu Dongxiao > #include <stdio.h> > #include <stdlib.h> > #include <SDL.h> > > int main() > { > uint8_t *bufp; > int i; > SDL_Surface *shared; > > if ( SDL_Init(SDL_INIT_AUDIO|SDL_INIT_VIDEO) < 0 ) { > fprintf(stderr, ".....SDL: %s\n", SDL_GetError()); > exit(1); > } > atexit(SDL_Quit); > shared = SDL_SetVideoMode(320, 240, 24, SDL_SWSURFACE); > if ( shared == NULL ) { > fprintf(stderr, "Error to set video mode: %s\n", > SDL_GetError()); > exit(1); > } > if ( SDL_MUSTLOCK(shared) ) { > if ( SDL_LockSurface(shared) < 0 ) { > return; > } > } > > bufp = (Uint8 *)shared->pixels; > for (i=0; i<320*240; i++) { > *(bufp+shared->format->Rshift/8+3*i) = 63; > *(bufp+shared->format->Gshift/8+3*i) = 127; > *(bufp+shared->format->Bshift/8+3*i) = 191; > } > if ( SDL_MUSTLOCK(shared) ) { > SDL_UnlockSurface(shared); > } > SDL_UpdateRect(shared, 0, 0, 320, 240); > while(1); > } > > [demime 1.01d removed an attachment of type image/jpeg which > had a name of color.jpg] > _______________________________________________ > VNC-List mailing list > VNC-List@realvnc.com > To remove yourself from the list visit: > http://www.realvnc.com/mailman/listinfo/vnc-list > _______________________________________________ VNC-List mailing list VNC-List@realvnc.com To remove yourself from the list visit: http://www.realvnc.com/mailman/listinfo/vnc-list