[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Sync with vertical refresh does not work(?)



Good idea, indeed my driver was "windib" ("windb" in the FAQ seems to
be a typo) not "directx". However, with directx, the tearing remains.
Again I tried any combination (fullscreen/windowed, hw/sw surface, and
doublebuf). BTW, the directx driver seems to not work properly with de
DOUBLEBUF flag when in fullscreen mode, objects are only partially
displayed and there's no flashes.

I also reduced my code to be as minimal as possible:
(don't care for the opts variable, I tried the other variants as well)

os.environ['SDL_VIDEODRIVER'] = 'directx'
pygame.init()
opts = pygame.SWSURFACE
screen = pygame.display.set_mode((800,800),opts)
image = pygame.Surface( (200,200) )
rect = image.get_rect(center=(200,180))
pygame.draw.rect(image,(255,255,255),rect)

while 1:
    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()
    screen.fill( (0,0,0) )
    pygame.display.flip()
    pygame.time.delay(300)
    screen.blit(image, rect)
    pygame.display.flip()
    pygame.time.delay(300)

2009/1/30 Lenard Lindstrom <len-l@xxxxxxxxx>:
> One other thing to try is switch graphics drivers. By default Pygame should
> use DirectX for Windows XP. It's easy to check with the
> pygame.display.get_driver() function. When called after pygame.init() it
> will either return 'directx' or 'windb' for Windows. To select the other
> driver set the SDL_VIDEODRIVER environment variable before the pygame.init()
> call. It is explained, along with a code example, at the Pygame FAQ:
>
> http://www.pygame.org/wiki/FrequentlyAskedQuestions
>
> Lenard
>
> Matthias Treder wrote:
>>
>> I tried out changing the graphics settings, but they had no effect.
>> The tearing occurs both in fullscreen and windowed mode, btw.
>>
>>
>
>
> --
> Lenard Lindstrom
> <len-l@xxxxxxxxx>
>
>