Exemplo n.º 1
0
		gl.glDrawArrays(gl.GL_POINTS, 0, self.count)

	def resizeGL(self, width, height):
		self.width, self.height = width, height
		gl.glViewport(0, 0, width, height)
		gl.glMatrixMode(gl.GL_PROJECTION)
		gl.glLoadIdentity()
		#glOrtho(left, rught, bottom, top, nearX, farZ)
		gl.glOrtho(-200, 200, -200, 200, -1, 1)
 
if __name__ == '__main__':
	import sys
	import numpy
	import time
	
	myBoids = Boid.Boids()
	myBoids.setAreaWidth(200)
	
	class MainWindow(QtGui.QMainWindow):
		def __init__(self):
			super(MainWindow, self).__init__()
			coord = myBoids.getCoords2D()
			self.data = numpy.array(coord, dtype=numpy.float32)
			
			self.widget = GLPlotWidget()
			self.widget.set_data(self.data)
			
			# Put the window at (100, 100)
			self.setGeometry(100, 100, self.widget.width, self.widget.height)
			self.setCentralWidget(self.widget)