It's my understanding that the first, and last vertexes need to be 
duplicated. Something about terminating the points. I could be off base 
here, since the last time I wrote OpenGL was about 2 years ago with another 
framework and likely in modern OpenGL, but give that a look :)

On Tuesday, January 19, 2016 at 10:26:34 AM UTC+9, Pygler wrote:
>
> I am trying to batch draw a bunch of circles using their vertices (using 
> below function to generate many circles) instead of using glVertex2f in a 
> loop to draw a circle.
>
> class Snowflake(object):
>     def __init__(self, x, y, radius, d, batch):
>         self.x = x
>         self.y = y
>         self.r = radius
>         self.d = d
>         circle = self.create_vertices(x, y, self.r)
>         self.vertex_list = batch.add(len(circle[1])//2, 
> pyglet.gl.GL_POLYGON, None,
>                 circle,('c4f',(1, 1, 1, 0.8)*(len(circle[1])//2)))
>         
>     def create_vertices(self, x, y, radius, sides=24):
>         vertices = []
>         for i in range(sides):
>             angle = math.radians(float(i)/sides * 360.0)
>             x1 = radius*math.cos(angle) + x
>             y1 = radius*math.sin(angle) + y
>             vertices += [x1,y1]
>
>
>         return ('v2f', vertices)
>
>
> However, upon doing this and running batch.draw(), it links each polygon 
> together from where the last vertice is in each vertex list to the start of 
> the next. Is it not possible to batch polygons and separate them like this 
> or is there something I am missing? Sorry if this is a stupid question. 
> Thanks for any help.
>

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