Thanks for taking a closer look. I did not manage to take a look yet. Could 
you create an issue for this at https://bitbucket.org/pyglet/pyglet/issues ?

I see there is a test for multitexturing, but it already mentions it has 
only limited verification.

Rob

Op donderdag 16 april 2015 05:14:53 UTC+2 schreef magu...@gmail.com:
>
>
> Hm, nothing? Well I guess I should give people more to go on.
>
> Anyway, I made a multi-texture grid, but whenever I tried to access or 
> change the tex_coords it would crash with an error: "_get_tex_coords: 
> attribute = domain.attribute_names['tex_coords']"
> Digging into pyglet-1.2.2 VertexDomain.py, Multi-texture arrays are stored 
> as "multi_tex_coords" in domain.atribute_names, and the functions have no 
> way of interacting with them.
> So I made a few modifications:
>
>     def _get_tex_coords(self):
>         if 'multi_tex_coords' not in self.domain.attribute_names:
>             if (self._tex_coords_cache_version != self.domain._version):
>                 domain = self.domain
>                 attribute = domain.attribute_names['tex_coords']
>                 self._tex_coords_cache = attribute.get_region(
>                     attribute.buffer, self.start, self.count)
>                 self._tex_coords_cache_version = domain._version
>
>             region = self._tex_coords_cache
>             region.invalidate()
>             return region.array
>         else:
>             return None
>
>     def _set_tex_coords(self, data):
>         self._get_tex_coords()[:] = data
>
>     tex_coords = property(_get_tex_coords, _set_tex_coords,
>                           doc='''Array of texture coordinate data.''')
>
>     # ---
>
>     def _get_multi_tex_coords(self):
>         if 'tex_coords' not in self.domain.attribute_names:
>             if (self._tex_coords_cache_version != self.domain._version):
>                 domain = self.domain
>                 attribute = domain.attribute_names['multi_tex_coords']
>                 self._tex_coords_cache = []
>                 for a in attribute.keys():
>                     self._tex_coords_cache.append(attribute[a].get_region(
>                         attribute[a].buffer, self.start, self.count))
>                     self._tex_coords_cache_version = domain._version
>
>             region = self._tex_coords_cache
>             array = []
>             for a in region:
>                 a.invalidate()
>                 array.append(a.array)
>             return array
>         else:
>             return None
>
>     def _set_multi_tex_coords(self, data):
>         if self._get_multi_tex_coords() != None:
>             for a in xrange(0, len(self._tex_coords_cache),1):
>                 if data[a] != None:
>                     self._tex_coords_cache[a].array[:] = data[a]
>
>     multi_tex_coords = property(_get_multi_tex_coords, 
> _set_multi_tex_coords,
>                                 doc='''Multi-array texture coordinate 
> data.''')
>
> I'm sure it could use some improvement, but it seems to get the job done. 
> When you call tex_coords it will return None if its a multi_tex_coord 
> object, and vice versa if its a regular
> tex_coord. _get_multi_tex_coords returns a list with the tex_coord 
> array's, and you can set them by writing: array.multi_tex_coord = 
> [(0,0,0...),etc]. Optionally you can update specific
> arrays by returning None: array.multi_tex_coord = [(0,0,0...), None, 
> (0,0,0...)]. I've written a small example program i'll attach.
>
> Some of the problems i've run into involve the clock and blitted images 
> messing up, though i'm beginning to think its how I handle the multi-tex 
> rendering rather than something in pyglet,
> again don't know enough to narrow it down, yet anyway. Also, the example 
> script was written with the above modifications to VertexDomain.py.
>

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to