def draw(self): """Render the particles""" #update or particle positions by calling the OpenCL kernel #for i in xrange(0, 10): #10 updates per frame # self.boids.execute() self.boids.rules() self.boids.euler() glFlush() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glLoadIdentity() #handle mouse transformations """ glTranslatef(self.initrans.x, self.initrans.y, self.initrans.z) glRotatef(self.rotate.x, 1, 0, 0) glRotatef(self.rotate.y, 0, 1, 0) #we switched around the axis so make this rotate_z glTranslatef(self.translate.x, self.translate.y, self.translate.z) """ #render the particles self.boids.render() #draw the x, y and z axis as lines glutil.draw_axes() glutSwapBuffers()
def draw(self): """Render the particles""" #update or particle positions by calling the OpenCL kernel rgb, depth = self.kin.get_particles() self.cle.load_images(rgb, depth) self.cle.execute(1) #self.cle.execute(1) glFlush() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glLoadIdentity() #handle mouse transformations glTranslatef(self.initrans.x, self.initrans.y, self.initrans.z) glRotatef(self.rotate.x, 1, 0, 0) glRotatef(self.rotate.y, 0, 1, 0) #we switched around the axis so make this rotate_z glTranslatef(self.translate.x, self.translate.y, self.translate.z) #render the particles self.cle.render() #draw the x, y and z axis as lines glutil.draw_axes() glutSwapBuffers()
def draw(self): """Render the particles""" #update or particle positions by calling the OpenCL kernel self.cle.execute(subintervals) glFlush() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glLoadIdentity() #handle mouse transformations glTranslatef(self.initrans.x, self.initrans.y, self.initrans.z) glRotatef(self.rotate.x, 1, 0, 0) glRotatef(self.rotate.y, 0, 1, 0) #we switched around the axis so make this rotate_z glTranslatef(self.translate.x, self.translate.y, self.translate.z) #render the particles self.cle.render() #draw the x, y and z axis as lines glutil.draw_axes() glutSwapBuffers()
def draw(): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) example.execute() #glColor3f(1,0,0) glEnable(GL_POINT_SMOOTH) glPointSize(2) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) example.col_vbo.bind() glColorPointer(4, GL_FLOAT, 0, example.col_vbo) example.pos_vbo.bind() glVertexPointer(4, GL_FLOAT, 0, example.pos_vbo) glEnableClientState(GL_VERTEX_ARRAY) glEnableClientState(GL_COLOR_ARRAY) glDrawArrays(GL_POINTS, 0, num) glDisableClientState(GL_COLOR_ARRAY) glDisableClientState(GL_VERTEX_ARRAY) glDisable(GL_BLEND) gl.draw_axes() pygame.display.flip()
def draw(): glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) example.execute() #glColor3f(1,0,0) glEnable(GL_POINT_SMOOTH) glPointSize(2) glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) example.col_vbo.bind() glColorPointer(4, GL_FLOAT, 0, example.col_vbo) example.pos_vbo.bind() glVertexPointer(4, GL_FLOAT, 0, example.pos_vbo) glEnableClientState(GL_VERTEX_ARRAY) glEnableClientState(GL_COLOR_ARRAY) glDrawArrays(GL_POINTS, 0, num) glDisableClientState(GL_COLOR_ARRAY) glDisableClientState(GL_VERTEX_ARRAY) glDisable(GL_BLEND) gl.draw_axes() pygame.display.flip()
def draw(self): """Render the particles""" #TODO: # * set up Ortho2D viewing and mouse controls # * find better color mapping for height #update or particle positions by calling the OpenCL kernel for i in range(subintervals): self.clsystem.update() #self.cle.execute(subintervals) glFlush() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glLoadIdentity() #handle mouse transformations #glTranslatef(self.initrans.x, self.initrans.y, self.initrans.z) glRotatef(self.rotate.x, 1, 0, 0) glRotatef(self.rotate.y, 0, 1, 0) glTranslatef(self.translate.x, self.translate.y, self.translate.z) #render the particles self.clsystem.render() self.clghost_system.render() #draw the x, y and z axis as lines glutil.draw_axes() glutSwapBuffers()
def draw(self): """Render the particles""" glFlush() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) if self.white == -1: glClearColor(1, 1, 1, 1) else: glClearColor(0, 0, 0, 0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() #handle mouse transformations glTranslatef(self.initrans.x, self.initrans.y, self.initrans.z) glRotatef(self.rotate.x, 1, 0, 0) glRotatef(self.rotate.y, 0, 1, 0) #we switched around the axis so make this rotate_z glTranslatef(self.translate.x, self.translate.y, self.translate.z) #render the particles self.render_image() self.render() #draw the x, y and z axis as lines glutil.draw_axes() ############## enable 2d display ####################### glMatrixMode(GL_PROJECTION) glPushMatrix() glLoadIdentity() glOrtho(0.0, self.width, self.height, 0.0, -1.0, 10.0) glMatrixMode(GL_MODELVIEW) glLoadIdentity() glDisable(GL_CULL_FACE) glClear(GL_DEPTH_BUFFER_BIT) self.glut_print( 10 , 15 , GLUT_BITMAP_9_BY_15 , self.str_curr_cycle , 0.0 , 1.0 , 0.0 , 1.0) self.glut_print( 10 , 30 , GLUT_BITMAP_9_BY_15 , self.str_curr_temp , 0.0 , 1.0 , 0.0 , 1.0) self.glut_print( 10 , 45 , GLUT_BITMAP_9_BY_15 , self.str_curr_id_frag , 0.0 , 1.0 , 0.0 , 1.0) self.glut_print( 10 , 60 , GLUT_BITMAP_9_BY_15 , self.str_likelihood , 0.0 , 1.0 , 0.0 , 1.0) self.glut_print( 10 , 75 , GLUT_BITMAP_9_BY_15 , self.str_n_contigs , 0.0 , 1.0 , 0.0 , 1.0) self.glut_print( 10 , 90 , GLUT_BITMAP_9_BY_15 , self.str_curr_dist , 0.0 , 1.0 , 0.0 , 1.0) # self.glut_print( 10 , 15 , GLUT_BITMAP_9_BY_15 , self.str_curr_cycle , 1.0 , 1.0 , 1.0 , 1.0) # self.glut_print( 10 , 30 , GLUT_BITMAP_9_BY_15 , self.str_curr_temp , 1.0 , 1.0 , 1.0 , 1.0) # self.glut_print( 10 , 45 , GLUT_BITMAP_9_BY_15 , self.str_curr_id_frag , 1.0 , 1.0 , 1.0 , 1.0) # self.glut_print( 10 , 60 , GLUT_BITMAP_9_BY_15 , self.str_likelihood , 1.0 , 1.0 , 1.0 , 1.0) # self.glut_print( 10.1 , 60.1 , GLUT_BITMAP_9_BY_15 , self.str_likelihood , 1.0 , 1.0 , 1.0 , 1.0) # self.glut_print( 9.9 , 59.9, GLUT_BITMAP_9_BY_15 , self.str_likelihood , 1.0 , 1.0 , 1.0 , 1.0) # self.glut_print( 10 , 75 , GLUT_BITMAP_9_BY_15 , self.str_n_contigs , 1.0 , 1.0 , 1.0 , 1.0) # self.glut_print( 10 , 90 , GLUT_BITMAP_9_BY_15 , self.str_curr_dist , 1.0 , 1.0 , 1.0 , 1.0) ## Making sure we can render 3d again glMatrixMode(GL_PROJECTION) glPopMatrix() glMatrixMode(GL_MODELVIEW) ############# glutSwapBuffers()
def draw(): glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) example.execute() #glColor3f(1,0,0) gl.draw_axes() pygame.display.flip()
def draw(): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) example.execute() #glColor3f(1,0,0) gl.draw_axes() pygame.display.flip()
def draw(): glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT) #glLoadIdentity() #glTranslatef(-10.0, -10.0, -36.0) #glTranslatef(0.,0.,-6.) gl.draw_axes() glColor3f(1,1,1) glPointSize(5) #glBegin(GL_POINTS) #glVertex3f(0,0,0) #glVertex3f(1,1,1) #glVertex3f(0, 1, 0) #glEnd() #origin o = Vec([0.,0.,0.]) #direction u = normalize(Vec([1., 1., 1.])) #orthogonal vec v,w = orthovec(u) #w = rotateaxis(u, v, 90) #print u #print v #print w glColor3f(.5, 1, 0) gl.draw_line(o, u) glColor3f(0, 1, .5) gl.draw_line(o, v) glColor3f(.5, 0, .5) gl.draw_line(o, w) particles = distribute_disc(u, v, w, 1, 300, .1) print len(particles) glBegin(GL_POINTS) glColor3f(1, 1, 1) glVertex3f(u.x, u.y, u.z) glColor3f(.5, .5, .5) for p in particles: glVertex3f(p.x, p.y, p.z) glEnd() pygame.display.flip()
def draw(self): """Render the particles""" glFlush() glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) glLoadIdentity() # handle mouse transformations glTranslatef(self.initrans.x, self.initrans.y, self.initrans.z) glRotatef(self.rotate.x, 1, 0, 0) glRotatef(self.rotate.y, 0, 1, 0) # we switched around the axis so make this rotate_z glTranslatef(self.translate.x, self.translate.y, self.translate.z) # draw the x, y and z axis as lines glutil.draw_axes() glutSwapBuffers()
def draw(self): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) self.set3d() glMatrixMode(GL_MODELVIEW) glPushMatrix() glLoadIdentity() #handle mouse transformations glTranslatef(self.initrans.x, self.initrans.y, self.initrans.z) glRotatef(-self.rotate.x, 1, 0, 0) glRotatef(self.rotate.y, 0, 1, 0) #we switched around the axis so make this rotate_z glTranslatef(self.translate.x, self.translate.y, self.translate.z) self.cle.render() #draw the x, y and z axis as lines glutil.draw_axes() glPopMatrix() self.unset3d()