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

Re: [pygame] Options for smooth-scrolling in X-Windows



If you can find an easy way to render a surface to a texture you might
be able to easily sidestep this whole problem, this might be a start:
http://pitchersduel.iuplog.com/default.asp?item=170661
I've never used it but i will probably be giving it a ping in the not
too distant future.


2009/2/25 Yanom Mobis <yanom@xxxxxxxxxxxxxx>:
> you need to support Linux.
> you could write two versions of the interface, one for Linux/UNIX/Mac and
> one for Windows, if necessary
>
>
> --- On Mon, 2/23/09, René Dudfield <renesd@xxxxxxxxx> wrote:
>
> From: René Dudfield <renesd@xxxxxxxxx>
> Subject: Re: [pygame] Options for smooth-scrolling in X-Windows
> To: pygame-users@xxxxxxxx
> Date: Monday, February 23, 2009, 4:29 PM
>
> hi,
>
> It's all dependant on your OS, video card and driver?
>
> So which driver?
>
> eg, with ubuntu there is this link which mentions it:
> http://ubuntuforums.org/showthread.php?p=3622012
>
>
> cheers,
>
>
>
>
> On Tue, Feb 24, 2009 at 5:02 AM, Weeble <clockworksaint@xxxxxxxxx> wrote:
>> I'm trying to do full-screen scrolling, using pygame in X-Windows. As
>> far as I can tell, there's no way around the problem of tearing. Is
>> that true? Here's a simple example that gives me problems:
>>
>> import pygame
>> from pygame..locals import *
>> from random import randint
>>
>> pygame.init()
>> opts = pygame.FULLSCREEN|pygame.DOUBLEBUF|pygame.HWSURFACE
>> screen = pygame.display.set_mode((640,480),opts)
>>
>> rectangles=[Rect(randint(0,1200),randint(0,1200),64,64) for i in
>> xrange(200)]
>> clock = pygame.time.Clock()
>>
>> for i in xrange(300):
>>   screen.fill( (0,0,0) )
>>   for r in rectangles:
>>       screen.fill( (255,0,0), r.move(-4*i,-4*i) )
>>   pygame.display.flip()
>>   clock.tick_busy_loop(60)
>>
>> The problem is that the scrolling isn't smooth. There's a noticeable
>> flicker, resulting from the flip() being unsynchronised with the
>> screen refresh. (I've experimented with other settings for "opts"
>> above and I've used both tick and tick_busy_loop with similar
>> results.) Am I right in thinking that there's no way around this using
>> the x11 driver? Is there an alternative to this if I want people to be
>> able to play my game smoothly on Linux? I understand vsync is possible
>> in OpenGL, but I think that means I'd need to completely change my
>> rendering code and might have difficulty doing some of the stuff I do
>> at the moment. (I render between several intermediate surfaces using
>> various blend modes to do some effects.) Is that also the case? What
>> approach do people generally take? I can see a number of alternatives:
>>
>> 1. Don't use/support Linux.
>> 2. Avoid scrolling backgrounds, so tearing isn't such a big deal.
>> 3. Use OpenGL for all rendering, abandoning easy to use surfaces.
>> 4. Super magic solution to get working VSYNC under X-windows.
>>
>> Any advice would be much appreciated.
>>
>> Regards,
>>    Weeble.
>>
>
>