Hi All,

I've just been trying to get started using pyglet-1.1.2. Setup is as  
follows...

Mac OS 10.4.11
Intel 24" iMac ( white version, pre-aluminium).
Python 2.5.2 ( "enthon" distribution ")

I initially tried the pyglet that comes with Enthought distribution  
but since it was an egg I rebuild manually so that I could debug.


The simple demo below fails to run. ( Stack trace from IPython is  
below).

============================
import pyglet
#import pyglet.window

from pyglet.gl import Config

config = Config(sample_buffers=1, samples=4,
                 depth_size=16, double_buffer=True,)
window = WindowClass(resizable=True, config=config)

screen = pyglet.window.get_platform().get_default_display 
().get_default_screen()
============================

/Users/andy/<ipython console> in <module>()

/tmp/python-58174lg.py in <module>()
       2 #import pyglet.window
       3
----> 4 from pyglet.gl import Config
       5
       6 config = Config(sample_buffers=1, samples=4,

/Library/Frameworks/Python.framework/Versions/2.5.2001/lib/python2.5/ 
site-packages/pyglet/gl/__init__.pyc in <module>()
     503     'pyglet.window' not in _sys.modules and
     504     _pyglet.options['shadow_window']):
     505     # trickery is for circular import
     506     _pyglet.gl = _sys.modules[__name__]
--> 507     import pyglet.window

/Library/Frameworks/Python.framework/Versions/2.5.2001/lib/python2.5/ 
site-packages/pyglet/window/__init__.pyc in <module>()
    1687
    1688 # Create shadow window. (trickery is for circular import)
    1689 if not _is_epydoc:
    1690     pyglet.window = sys.modules[__name__]
-> 1691     gl._create_shadow_window()

/Library/Frameworks/Python.framework/Versions/2.5.2001/lib/python2.5/ 
site-packages/pyglet/gl/__init__.pyc in _create_shadow_window()
     489
     490     from pyglet.window import Window
--> 491     _shadow_window = Window(width=1, height=1, visible=False)
     492     _shadow_window.switch_to()
     493

/Library/Frameworks/Python.framework/Versions/2.5.2001/lib/python2.5/ 
site-packages/pyglet/window/__init__.pyc in __init__(self, width,  
height, caption, resizable, style, fullscreen, visible, vsync,  
display, screen, config, context)
     649
     650         if not config.is_complete():
--> 651             config = screen.get_best_config(config)
     652
     653         print "Best - %s" % config

/Library/Frameworks/Python.framework/Versions/2.5.2001/lib/python2.5/ 
site-packages/pyglet/window/__init__.pyc in get_best_config(self,  
template)
     290         configs = self.get_matching_configs(template)
     291         if not configs:
--> 292             raise NoSuchConfigException()
     293         return configs[0]
     294

NoSuchConfigException:
===============================

 From what I've been able to gather -

/Library/Frameworks/Python.framework/Versions/2.5.2001/lib/python2.5/ 
site-packages/pyglet/window/__init__.pyc:290

configs = self.get_matching_configs(template)

calls into ....

/Library/Frameworks/Python.framework/Versions/2.5.2001/lib/python2.5/ 
site-packages/pyglet/window/carbon/__init__.py

     def get_matching_configs(self, template):
         # Construct array of attributes for aglChoosePixelFormat
         attrs = []
         for name, value in template.get_gl_attributes():
             attr = CarbonGLConfig._attribute_ids.get(name, None)
             if not attr or not value:
                 continue
             attrs.append(attr)
             if attr not in CarbonGLConfig._boolean_attributes:
                 attrs.append(int(value))

         # Support for RAGE-II, which is not compliant
         attrs.append(agl.AGL_ALL_RENDERERS)

         # Force selection policy and RGBA
         attrs.append(agl.AGL_MAXIMUM_POLICY)
         attrs.append(agl.AGL_RGBA)

         # In 10.3 and later, AGL_FULLSCREEN is specified so the  
window can
         # be toggled to/from fullscreen without losing context.  pyglet
         # no longer supports earlier versions of OS X, so we always  
supply it.
         attrs.append(agl.AGL_FULLSCREEN)

         # Terminate the list.
         attrs.append(agl.AGL_NONE)
         attrib_list = (c_int * len(attrs))(*attrs)

         device = self.get_gdevice()
         pformat = agl.aglChoosePixelFormat(device, 1, attrib_list)
         _aglcheck()

         if not pformat:
             return []
         else:
             return [CarbonGLConfig(self, pformat)]

===============================================

I've ran through this function in pdb and immediately prior to exit  
pformat and device
are set as follows ....

(Pdb) device
<ctypes.LP_LP_struct_GDevice object at 0x15119e0>
(Pdb) bool(device)
True
(Pdb) pformat
<ctypes.LP_struct___AGLPixelFormatRec object at 0x1511a30>
(Pdb) bool(pformat)
False
(Pdb)

since pformat evaluates to false the list returned by  
get_matching_configs is empty hence the exception. My guess is the  
underlying C API returned a Null and a 'False' object is how ctypes  
represents this right?

I'm not really sure what attributes I should be trying to pass into  
agl.aglChoosePixelFormat(device, 1, attrib_list) otherwise I would  
debug further.

Can anyone help?!

Many thanks!

A.







=

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pyglet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to