Re: Beginner has trouble with SDL in foll-screen mode.
On Fri, 10 Aug 2007 17:58:07 -0400
Orestes leal <orestesleal13022@cha.jovenclub.cu> wrote:
> On Fri, 10 Aug 2007 21:39:47 +0000 (UTC)
> Hendrik Boom <hendrik@topoi.pooq.com> wrote:
>
> > I have a small program that makes a time-varying pattern on the
> > screen. It works fine with SDL_RESIZABLE, but not with SDL_FULLSCREEN.
> >
> > In full-screen mode everything is sheared off into wavy lines, as if the
> > screen geometry I'm using is not the actual one.
> >
> > Now I understand that it may be unable to deliver the desired resolution,
> > but if so SDL_SetVideoMode should be returning error indication,
> > right?
> >
> > Although I don't get an error return, i called SDL_GetError anyway and got
> > the following message:
> >
> > Failed loading DPMSDisable: /usr/lib/libX11.so.6: undefined symbol: DPMSDisable
> >
> > I don't know if that means anything important, because it happens
> > both with SDL_FULLSCREEN and with SDL_RESIZABLE.
> >
> > Here's the code. The #if is how I switch between full-screen and
> > resizable. Am I doing something obviously wrong?
> >
> >
> > #include <SDL/SDL.h>
> > #include <stdio.h>
> > #include <stdlib.h>
> >
> > Uint16 CreateHicolorPixel(
> > SDL_PixelFormat * fmt,
> > Uint8 red,
> > Uint8 green,
> > Uint8 blue)
> > {
> > Uint16 value;
> > value = ((red >> fmt->Rloss) << fmt->Rshift) +
> > ((green >> fmt->Gloss) << fmt->Gshift) +
> > ((blue >> fmt->Bloss) << fmt->Bshift);
> > return value;
> > }
> >
> > int main()
> > {
> > SDL_Surface *screen;
> > Uint16 *raw_pixels;
> > int x, y, t;
> >
> > printf("At start GetError says: %s\n", SDL_GetError());
> > if(SDL_Init(SDL_INIT_VIDEO) != 0)
> > {
> > printf("unable to initialize SDL: %s\n", SDL_GetError());
> > return 1;
> > }
> > atexit(SDL_Quit);
> >
> > printf("After SDL_INIT GetError says: %s\n", SDL_GetError());
> > #if 1
> > screen = SDL_SetVideoMode(640, 480, 16, SDL_FULLSCREEN);
> > #else
> > screen = SDL_SetVideoMode(640, 480, 16, SDL_RESIZABLE);
> > #endif
> >
> > printf("after SetVideoMods GetError says: %s\n", SDL_GetError());
> > if(screen == NULL)
> > {
> > printf("unable to set video mode: %s\n", SDL_GetError());
> > return 1;
> > }
> >
> > for(t = 0; t < 20; ++t)
> > {
> > SDL_LockSurface(screen);
> > raw_pixels = (Uint16 *) screen->pixels;
> > for(x = 0; x < screen->w; x++)
> > {
> > for(y = 0; y < screen->h; y++)
> > {
> > Uint16 pixel_color;
> > int offset;
> > pixel_color = CreateHicolorPixel(screen->format,
> > (x * t) >> 4,
> > (x ^ y) + t,
> > (y * t) >> 4
> >
> > );
> > offset = (screen->pitch / 2 * y + x);
> > raw_pixels[offset] = pixel_color;
> > }
> > }
> > SDL_UnlockSurface(screen);
> > SDL_UpdateRect(screen, 0, 0, 0, 0);
> > SDL_Delay(8);
> > }
> >
> > SDL_Delay(3000);
> > printf("success!\n");
> > return 0;
> > }
> >
> >
> > --
> > To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> > with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
>
> Which version of SDL you have?
> Maybe this problem it's coming from rhe windowed system (xorg),
>
> -olr
>
>
Actually it's a bug already solved it depends on the version you have.
-olr
Reply to: