To recap: this thread started with a question. How do I know whether DOUBLEBUF has been set with:

    screen = pygame.display.set_mode((720,480), pygame.DOUBLEBUF | pygame.FULLSCREEN)


On 09/06/2018 22:04, Mark Lawrence wrote:
On 09/06/18 20:31, Paul St George wrote:

     print pygame.display.get_surface()
gives
<Surface(720x480x32 SW)>

and
     print screen.get_flags()
gives
-2147483648

The lists of flags at <https://www.pygame.org/docs/ref/surface.html#pygame.Surface.get_flags> and <http://www.rpi.edu/dept/acm/packages/SDL/1.2.6/include/SDL/SDL_video.h>

has nothing remotely like -2147483648. I would expect something more like 0x40000000

Am I using the wrong code to determine whether I have successfully set DOUBLEBUF with

     screen = pygame.display.set_mode((720,480), pygame.FULLSCREEN | pygame.DOUBLEBUF)

AND

What does -2147483648 tell me? Does this number need converting?


From the interactive interpreter:-

>>> hex(-2147483648)
'-0x80000000'
>>> hex(pygame.FULLSCREEN)
'-0x80000000'
>>> hex(pygame.DOUBLEBUF)
'0x40000000'

Thanks go to Mark Lawrence and Richard Damon.

Using
print hex(screen.get_flags())

I can see that the order of the two flags does not make a difference.

screen = pygame.display.set_mode((720,480), pygame.DOUBLEBUF | 
pygame.FULLSCREEN)
screen = pygame.display.set_mode((720,480), pygame.FULLSCREEN | 
pygame.DOUBLEBUF)

both report the same

print hex(screen.get_flags())

'-0x80000000'


BUT
omitting DOUBLEBUF from the code

screen = pygame.display.set_mode((720,480), pygame.FULLSCREEN)

also makes no difference to the report

print hex(screen.get_flags())

'-0x80000000'


AND

with with only DOUBLEBUF in the code

screen = pygame.display.set_mode((720,480), pygame.DOUBLEBUF)

does not give the expected and desired '-0x40000000'

instead, the report is

print hex(screen.get_flags())

‘0x0’



0x0 (SWSURFACE) is consistent with

print pygame.display.get_surface()
‘<Surface(720x480x32 SW)>’


It seems that DOUBLEBUF is *not* being set. I am guessing this is because the 
arguments passed by pygame.display.set_mode() are only requests.  The actual 
display will depend on the system, and what is available/possible.

More guessing leads me to wonder whether DOUBLEBUF is only available when 
HWSURFACE is being used so I tried three flags with:

flags = pygame.FULLSCREEN | pygame.DOUBLEBUF | pygame.HWSURFACE
screen = pygame.display.set_mode((0, 0), flags)

But no change (screen is still SW and DOUBLEBUF is not set):


print pygame.display.get_surface()
<Surface(720x480x32 SW)>

print hex(screen.get_flags())
-0x80000000


QUESTIONS
Can anyone find an error in any of this? I hope so.

Is DOUBLEBUF dependent on HWSURFACE?

If so, how does one force the change to a Hardware surface? ‘set_mode’ is not 
doing it.


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to