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

Reply via email to