On Mon, Nov 7, 2011 at 10:10 PM, Tristam MacDonald <[email protected]>wrote:
> On Mon, Nov 7, 2011 at 11:13 AM, Emanuele <[email protected]>wrote: > >> Hi, >> >> I'm really new to pyglet and I'd like to know how to copy.deepcopy() >> or pickle >> a VertexList and how to restore it at a later stage. >> >> Up to now I observe this behavior (assume 'a' is a VertexList object): >> >> In [112]: copy.deepcopy(a) >> [....very long....] >> TypeError: instancemethod expected at least 2 arguments, got 0 >> >> In [115]: pickle.dump(a, open('/tmp/test.pickle','w')) >> [....very long....] >> TypeError: can't pickle instancemethod objects >> >> Is there a way to store a VertexList instance for re-use at a later >> stage? >> > > No, pyglet doesn't handle the pickling of OpenGL objects. See this thread > for a more in-depth discussion: > > > http://groups.google.com/group/pyglet-users/browse_thread/thread/427ef0a486c0d9fb/960896360ac04417 > > In essence, the recommendation is that instead of pickling the VertexList > itself, you instead store whatever information (vertex data, etc.) that you > need to create the VertexList in the first place, and then you can load > that and re-create the VertexList whenever needed. > > Thanks for answering, My current solution is exactly what you suggest but it is a bit too slow in my case. I'll go through the in-depth discussion that you suggested. Best, Emanuele -- 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.
