# coding: utf-8 __author__ = 'ypw' from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * import common import sys window = 0 sph = common.sphere(16,16,1) camera = common.camera() plane = common.plane(12,12,1.,1.) def InitGL(width,height): glClearColor(0.1,0.1,0.5,0.1) glClearDepth(1.0) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) glMatrixMode(GL_PROJECTION) glLoadIdentity() gluPerspective(45.0,float(width)/float(height),0.1,100.0) camera.move(0.0,3.0,-5) def DrawGLScene(): glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glMatrixMode(GL_MODELVIEW) camera.setLookat() plane.draw() glTranslatef(-1.5,0.0,0.0) glBegin(GL_QUADS) glVertex3f(-1.0, 1.0, 0.0) glVertex3f(1.0, 1.0, 0.0)
plane_num = 2 # 用户数量 people_num = 20 # 飞机高度 plane_height = 2.6 # 地图长宽 plane_size = 110 plane_list = [] people_list = [] for i in range(plane_num): plane_list.append(common.sphere(16, 16, 0.1, 0, 0)) for i in range(people_num): people_list.append(common.sphere(16, 16, 0.1, 0, 0)) camera = common.camera() # 地形 plane = common.plane(plane_size, plane_size, 0.1, 0.1) #the shaderall,colorMap,hightMap Should be placed after gl init,otherwise all 0 shaderall = None tf = None ps = None colorMap = 0 hightMap = 0 x = 0 z = 0 def placeUAV(user_path_list): pass