On Mon, Feb 9, 2009 at 7:02 AM, Martin O'Leary <[email protected]>wrote:
> 2009/2/9 Tristam MacDonald <[email protected]> > >> On Mon, Feb 9, 2009 at 6:05 AM, Martin O'Leary <[email protected]>wrote: >> >>> >>> The question isn't so much how to structure my application, but how to >>> structure the interface I expose to others. If I'm implementing a drawable >>> class, the user will expect to be able to pass batch and group parameters, >>> as with other Pyglet drawables, and to have it do the right thing. >>> Internally, I know that it's much more efficient if we can share vertex >>> lists between instances, but the user doesn't know this, and really >>> shouldn't need to deal with it unless they want to. I'd rather sacrifice a >>> little efficiency for a unified interface. >>> >>> Martin >>> >> >> In my case, I expose a resource manager, and then pass resources by >> string. This way the resource manager ensures that each time a resource name >> is requested, the same resource is returned (texture, resources, models). >> The user can still screw things up, by registering the same resource under a >> bunch of different names, but at that point I assume they have a reason :) >> > > This is a solution to the problem, but it's a somewhat ad hoc one - there's > no uniform interface for dealing with such resource managers, and so the > user's code ends up being quite dependent on the specific interface you > provide, which is not ideal. Pyglet does provide a uniform interface for > dealing with drawables, through the batch and group system, and it would be > nice if extension authors could latch onto this, rather than inventing new > APIs every time. > > Martin > I don't really derive any advantage from exposing pyglet's interface - most of the functionality is wrapped by a higher level interface. Pyglet's batch model also doesn't play nice at all with any sort of culling, so I had to throw it out when the scenegraph was implemented. -- Tristam MacDonald http://swiftcoder.wordpress.com/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
