[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Options for smooth-scrolling in X-Windows
- To: pygame-users@xxxxxxxx
- Subject: Re: [pygame] Options for smooth-scrolling in X-Windows
- From: 12 Dogs <nathan.lanyon@xxxxxxxxx>
- Date: Wed, 25 Feb 2009 11:42:47 +1100
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: pygame-users-outgoing@xxxxxxxx
- Delivered-to: pygame-users@xxxxxxxx
- Delivery-date: Tue, 24 Feb 2009 19:42:50 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=ne6DSgJx49aXRGoabDS2UejewJ0Ej4KHU5B23clgzpU=; b=Nt4MoWpS3u8Np3KBZRaOwszCMIiOS093QDMRQAnAf2P2M9fGgf+QJcf5kaAzkxqqdE BptiN7BojBDllJ60hLwFITKVT2bxCLYitZIuB3+NUnYuCsF0vUINfshLbZnV75GiNYY/ sniPTvTZpjrFMpB8sHm3GkyyTPMiMUiD24HBw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=MDxEWbo2qGBWCRRMI7m3TshQYlgkBZlkpT3zPm9WxoS55Z/M0ctiw57wFxjhbSfQni Fos89lgcFkME2CfZvR1Il0Oa0VpymBGCXrZtv+l0Nd4erV+P/Tg/7R/Nl9mc6cc574tA cLyvymIpFnW7Zs8x/VEXhaInp9FfRTHuT/J/Q=
- In-reply-to: <139701.93754.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- References: <139701.93754.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: pygame-users@xxxxxxxx
- Sender: owner-pygame-users@xxxxxxxx
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.
>>
>
>