1
\$\begingroup\$

I was bored and dragging my game window around the screen and noticed something interesting.

When I drag my game window over to my secondary monitor, the screen updating just completely freezes.

Is there something I need to do to enable updating on a screen other than the primary monitor?

\$\endgroup\$
4
  • \$\begingroup\$ Are you using OpenGL, or Pygame/SDL's software buffers? \$\endgroup\$
    – user744
    Commented Aug 15, 2011 at 20:26
  • \$\begingroup\$ Going with the Pygame/SDL software buffers. \$\endgroup\$
    – erik
    Commented Aug 15, 2011 at 20:51
  • \$\begingroup\$ Does the game window update if you drag it back to the primary monitor, or does it remain "frozen"? \$\endgroup\$
    – zenzelezz
    Commented Aug 16, 2011 at 11:22
  • \$\begingroup\$ @zenzelezz: yes it does \$\endgroup\$
    – erik
    Commented Aug 16, 2011 at 13:08

2 Answers 2

2
\$\begingroup\$

This is a ERR in Pygame i'm sorry to say. Had this major problem when developing a toolkit for a company back in the days.

Edit: if the first "bug-ugly-fix" doesn't work, try my second suggestion!

The fix was sort of easy tho (if it works for you, this is NOT logical because it doesn't have anything to do with the actual problem BUT it worked for me, for some reason and), all you have to do is (before you call the render function):

# At the very top of your code, import:
from pyglet.gl import *

# then put this after clear() and before you draw anything:
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glEnable(GL_LINE_SMOOTH)
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE)

If i'm not mistaken this should work just fine, if that doesn't work then you can always force the application to start up on the second monitor if you know that it will always be located on it, that way you "start" the renderer on the second monitor and thus making that the primary monitor for the application, to do that, simply do:

class gfx(pyglet.window.Window):
    def __init__(self):
        super(gfx, self).__init__(sizeX, sizeY)
        self.platform = pyglet.window.get_platform()
        self.Disp = self.platform.get_default_display()
        self.Screen = self.Disp.get_screens()[screen_nr]

    ...

That should do the trick for you :)

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Why have you answered a pygame question with a pyglet solution? \$\endgroup\$
    – Kylotan
    Commented Sep 7, 2011 at 15:11
-1
\$\begingroup\$

Assuming you are using two separate graphics cards for the monitors in question, you have bound to the primary graphics card on the main monitor, and then drag it to the monitor the second card is rendering with. on -most- systems you will just take a huge performance hit as it still renders on the primary graphic card but then copies the data to the other one for display. In your case however it would seem its not capable of doing that.

All I know however is the hardware flow behind it, not the python and pygame software on top of it all.. But I would assume this hardware issue is why you are seeing your issues.

\$\endgroup\$
4
  • \$\begingroup\$ This sounds very unlikely if espais is using SDL's software renderer. \$\endgroup\$
    – user744
    Commented Aug 15, 2011 at 21:15
  • \$\begingroup\$ @Joe May seem unlikely, but the description and the follow up in the comments is spot on for rendering across multiple displays and their adapters... The targets were set upon start up and do not change when you drag the window around. \$\endgroup\$
    – James
    Commented Aug 17, 2011 at 19:42
  • \$\begingroup\$ I agree this is often the cause of problems, but even using terms like "targets" doesn't make sense given what espais is claiming to use. \$\endgroup\$
    – user744
    Commented Aug 17, 2011 at 19:53
  • \$\begingroup\$ Yeah, with out knowing what SDL actually does for its rendering it ends up being an unknown, and maybe even platform dependent with Windows 7 now being powered by DirectX... \$\endgroup\$
    – James
    Commented Aug 17, 2011 at 23:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .