Hello, i want to change the colormap-entries of an 8-bpp PseudoColor mode. Unfortunately it does not work.
I set up a collormap where every color is black and another one, where every color is yellow. After setting the video mode and clearing it with zeros, I install the black colormap, wait 3 seconds and then I install the yellow colormap and wait 3 seconds to see the result. I thought that I would then see a black screen and after 3 seconds I would see a yellow screen. But all I see is the black screen so the yellow colormap seems not to be installed. I have appended my source-code and would appreciate your help. Regards, Arne Caspari -----//snip//------------ #include <stdlib.h> #include <stdio.h> #include <X11/Xos.h> #include <X11/Intrinsic.h> #include <X11/Shell.h> #include <X11/StringDefs.h> #include <X11/Xatom.h> #include <X11/extensions/xf86dga.h> int main(){ Display *dis; XDGAMode *mode; XDGADevice *device; Colormap black_cmap; Colormap yellow_cmap; int selectedMode=-1; int num; int i, j; if (geteuid()){ fprintf(stderr, "Must be root!\n"); exit(1); } if ( (dis=XOpenDisplay(NULL))==NULL){ fprintf(stderr, "Cannot connect to X server %s\n", XDisplayName(NULL)); exit(-1); } mode=XDGAQueryModes(dis, DefaultScreen(dis), &num); for (i=0; i<num; i++){ printf ("----------------------------\n"); printf ("Mode: %i\n", mode[i].num); printf ("%i x %i x %i\n", mode[i].viewportWidth, mode[i].viewportHeight, mode[i].depth); switch (mode[i].visualClass){ case PseudoColor: printf("PseudoColor\n"); break; default: break; } if (mode[i].viewportWidth==800 && mode[i].viewportHeight==600 && mode[i].depth==8){ selectedMode=mode[i].num; } } printf ("----------------------------\n"); XFree(mode); printf ("Selected mode: %i\n", selectedMode); printf ("Bpp: %i\n",DisplayPlanes(dis, DefaultScreen(dis))); if (!XDGAOpenFramebuffer(dis, DefaultScreen(dis))){ fprintf(stderr, "Failed to map framebuffer-memory!\n"); exit(2); } if ( (device=XDGASetMode(dis, DefaultScreen(dis), selectedMode))==NULL){ fprintf(stderr, "Cannot set Mode!\n"); exit(2); } XDGASetViewport(dis, DefaultScreen(dis), 0, 0, XDGAFlipRetrace); black_cmap=XDGACreateColormap(dis, DefaultScreen(dis), device, AllocAll); for (i=0; i<256; i++){ XColor xcol; xcol.pixel=i; xcol.red=0; xcol.green=0; xcol.blue=0; xcol.flags=DoBlue|DoRed|DoGreen; XStoreColor(dis, black_cmap, &xcol); } yellow_cmap=XDGACreateColormap(dis, DefaultScreen(dis), device, AllocAll); for (i=0; i<256; i++){ XColor xcol; xcol.pixel=i; xcol.red=255*255; xcol.green=255*255; xcol.blue=0; xcol.flags=DoBlue|DoRed|DoGreen; XStoreColor(dis, yellow_cmap, &xcol); } //Fill viewport with 0s memset(device->data, (unsigned char)0, device->mode.viewportWidth*device->mode.viewportHeight); XDGAInstallColormap(dis, DefaultScreen(dis), black_cmap); sleep(3); XDGAInstallColormap(dis, DefaultScreen(dis), yellow_cmap); sleep(3); XDGACloseFramebuffer(dis, DefaultScreen(dis)); XDGASetMode(dis, DefaultScreen(dis), 0); exit(0); } -------------------------//snip//----------------------------------- _______________________________________________ Xpert mailing list [EMAIL PROTECTED] http://XFree86.Org/mailman/listinfo/xpert