On Friday 25 Sep 2015 15:51:43 Joe Cross wrote:
> I'm trying to render shapes efficiently in batches, but so far have
> run into some issues.
> 
> 
>    - Using GL_TRIANGLE_FAN for rendering a circle breaks when those
> circles are batched together (bitbucket issue)
>    <https://bitbucket.org/pyglet/pyglet/issues/64> (github code)
>   
> <https://github.com/numberoverzero/cells/blob/7989ed1a5af0199bf8df96f
> 7293792f2ad127452/shapes.py#L72> .
>    - Rotating individual rectangles when they're batched together
> (github code)
>   
> <https://github.com/numberoverzero/cells/blob/7989ed1a5af0199bf8df96f
> 7293792f2ad127452/shapes.py#L142> .
> 
> I'm working on a few ideas for the first (primarily, a new allocator
> that can toggle [or mark blocks ineligible for] merging/extending for
> adjacent alloc/realloc).  However, what is the recommended way to
> handle the latter case?
> 
> 
> The docs suggest I should batch triangles together for performance, so
> I'm creating all of my Rectangle instances with GL_TRIANGLE_STRIP
> (including degenerate vertices) in the same batch.  How then do I
> handle rotating each rectangle individually?  Let's say that I have
> 500 rectangles, all adjusting their rotation by a small random amount
> every 1/60 of a sec.  Is my only choice to re-calculate the vertices
> and bake the rotation in?  I'd love to use glRotatef or something,
> but that will apply a single rotation to all of my rectangles.
> 
> 
> This can't be a new problem.  Am I missing something obvious?
> 
> Right now I'm testing with this script
> <https://github.com/numberoverzero/cells/blob/7989ed1a5af0199bf8df96f7
> 293792f2ad127452/main.py> which generates a bunch of rectangles and
> rotates them all whenever the mouse is clicked/dragged.  I'd expect
> the framerate to stay higher than the 30-40 I'm getting for 341
> rectangles (2046 verts).
> 
> 
> python -O main.py
> 
> Python 3.5.0
> 
> Ubuntu 14.04 LTS on VMware Workstation 12.0.0 build-2985596
> (unlicensed) on Win7 SP1

I think you should do the rotations in a vertex shader but you will have 
to pass the rotation centre of each vertex to the shader. Write back if 
you need more help with how to implement that.

-- 
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 http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to