<https://lh3.googleusercontent.com/-vjANSBsggYo/WonRZLeZuaI/AAAAAAAAADY/SBo95v_t_YQN6tilNDfrX8ODWuMBy1YjQCLcBGAs/s1600/capture.png> Hi, I began to use openGL and pyglet. Now I'm trying to get a function who return a sector. I want to use GL_POLYGON draw method but I've got weird result... Can you help me? I use cos(pi/2) for my x coordinate and sin(pi/2) for my y coordinate. I used red for the outter ring and green for the inner ring. I only want to fill my array of points^^ I dont know much about openGL but it's a start! I already prepared the midi interface. Im only stuck with the graphic parts...
here is my code from pyglet.gl import * > from math import * > > class secteur(object): > def __init__(self, radius, inner_radius, angle, points): > self.radius = radius > self.inner_radius = inner_radius > self.angle = angle > self.points = points > self.vertex = [] > self.color = [] > for i in range(points): > angle=self.angle/points*i > x=cos(angle)*radius > y=sin(angle)*radius > z=0 > self.vertex.extend([x,y,z]) > self.color.extend([255,0,0]) > for i in range(points): > angle=self.angle-self.angle/points*i > x=cos(angle)*inner_radius > y=sin(angle)*inner_radius > z=0 > self.vertex.extend([x,y,z]) > self.color.extend([0,255,0]) > self.vertices = pyglet.graphics.vertex_list(2*points,('v3f', self. > vertex),('c3B',self.color)) > > class myWindow(pyglet.window.Window): > def __init__(self,*args,**kwargs): > super().__init__(*args,**kwargs) > self.set_minimum_size(300,300) > glClearColor(0.2,0.2,0.21,1) > self.secteur = secteur(0.5,0.3,pi/2,11) > > > def on_draw(self): > self.clear() > self.secteur.vertices.draw(GL_POLYGON) > > > def on_resize(self,width,height): > glViewport(0,0,width,height) > > > > if __name__ == "__main__": > windows = myWindow(800,800,"midi_visualizer",resizable=True) > > pyglet.app.run() > > > > -- 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 https://groups.google.com/group/pyglet-users. For more options, visit https://groups.google.com/d/optout.