I'm experimenting with this and it seems to be working so far.

On Thursday, December 15, 2016 at 8:45:47 AM UTC-5, Benjamin Moran wrote:
>
> Hi guys, 
>
> I was able to figure this out (I think). The solution was to just use 
> glMultiDrawArrays, and forget about using glMultiDrawElements. The 
> gl*Elements methods probably didn't make sense anyways, since the vertex 
> lists are not really indexed anyway. With glMultiDrawArrays, we just need 
> an array of the start + size of each vertex list. This information is 
> pretty easily grabbed from each vertex list, so the implementation turned 
> out to be very simple. Basically this: 
>
> starts = [vert_list.start for vert_list in self._vertex_lists]
> sizes = [vert_list.get_size() for vert_list in self._vertex_lists]
> primcount = len(starts)
> starts = (GLint * primcount)(*starts)
> sizes = (GLsizei * primcount)(*sizes)
> glMultiDrawArrays(mode, starts, sizes, primcount)
>
> The starts and sizes can be moved out of the draw method so that this is 
> only recalculated if the OrderedDomain is marked as dirty, and the 
> sort_vertex_lists method is called. I'll probably do this soon. 
>
>
>  
> On Monday, December 12, 2016 at 6:54:23 PM UTC+9, Benjamin Moran wrote:
>>
>> Hi Elliot,
>>
>> That sounds pretty nice. The null triangles idea makes sense. I guess it 
>> would be considered wasteful, but would be insignificant waste with even 
>> semi-modern GPU memory.
>> I find the numpy stuff fascinating. I also love pyglet for being "pure 
>> Python", as in only needing the standard library. I feel like there is a 
>> need for pyglet in the Python world, but certainly a need for more focused 
>> libraries like yours.
>>
>>
>> If you poke around my branch, you'll see it's fairly simple. It uses the 
>> default vertex lists and allocator, so there is fragmentation when 
>> deleting/migrating lists. I'm relying on the gl*Elements functions to draw 
>> things out of the order in which they're allocated. 
>>
>> The sort method is just a simple sort with lambda depth. The sort is only 
>> called when a vertex lists depth attribute is changed, so it should perform 
>> well if there aren't many changes. I hear the Python sort function is 
>> fairly fast, but I've not benchmarked it.
>>
>>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to