To clarify the calls in my original email were to draw a single polygon - i 
loop over them to draw the grid.  

On Monday, July 23, 2018 at 10:52:30 PM UTC-7, [email protected] wrote:
>
> Hi all,
>
> I've been working on my first pyglet project and have run into a strange 
> problem.  I am creating a hex grid that for now i am just drawing using 
> gl.POLYGON.  I first started drawing this grid using:
>
> pyglet.graphics.draw(
>     6, gl.GL_POLYGON, None,
>     ('v2f', locs), ('c4B', colors)
> )
>
> This gave me my expected result (a 2d grid of polygons).  Since then, I 
> have switched to using batches and groups:
>
> self._vertex_lists[s] = self._batch.add(
>     6, gl.GL_POLYGON, g,
>     ('v2f', locs), ('c4B', colors)
> )
>
> g here is one of these groups:
>
> class FillGroup(OrderedGroup):
>     def set_state(self):
>         gl.glEnable(gl.GL_BLEND)
>         gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
>         gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL)
>     def unset_state(self):
>         pass
> back_filled_grp = FillGroup(0)
> front_filled_grp = FillGroup(1)
>
>
> class LineGroup(OrderedGroup):
>     def set_state(self):
>         # TODO remove this since we don't care about line opacity
>         gl.glEnable(gl.GL_BLEND)
>         gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
>         gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE)
>     def unset_state(self):
>         gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL)
> line_grp = LineGroup(1)
>
> My current rendering looks like this (see attached file), which is 
> completely different than the nice 2d grid I had before.  When I mouse over 
> my hexes I draw another hex with alpha to show that I am mousing over (that 
> is the blue cone shape that before was just a hex!).  Any ideas what's 
> going on here?  I've quadruple checked that the hex vertices are being 
> generated in the same way as they were before I moved to using a batch.  
>
>  - Kovas
>

-- 
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