示例#1
0
文件: test.py 项目: mcydy/python
# 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)
示例#2
0
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


def make_plane(plane):
示例#3
0

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)           
    glVertex3f(1.0, -1.0, 0.0)          
示例#4
0
from PIL.Image import *
from OpenGL.GL import *
from OpenGL.GL import shaders
from OpenGL.GLU import *
from OpenGL.GLUT import *
import common
import loadtexture
import numpy as ny
import shaderProg
import sys
window = 0
sph = common.sphere(16, 16, 0.2)
camera = common.camera()
plane = common.plane(101, 101, 0.1, 0.1)
#the shaderall,colorMap,hightMap Should be placed after gl init,otherwise all 0
shaderall = None
colorMap = 0 
hightMap = 0 

def InitGL(width, height):
    glClearColor(0.1, 0.1, 0.5, 0.1)
    glClearDepth(1.0)
    glEnable(GL_DEPTH_TEST)
    glShadeModel(GL_SMOOTH)
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
    camera.move(0.0, 1.3, 0.0)   
    camera.setthree(True)
    camera.length = 3
    global shaderall
    shaderall = shaderProg.allshader() 
    global colorMap 
示例#5
0
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *
from OpenGL.GL import shaders
from Image import *
import common
import sys
import shaderProg
import loadtexture
import numpy as ny

window = 0
sph = common.sphere(16, 16, 0.2)
camera = common.camera()
plane = common.plane(101, 101, 0.1, 0.1)
#the shaderall,colorMap,hightMap Should be placed after gl init,otherwise all 0
shaderall = None
colorMap = 0
hightMap = 0


def InitGL(width, height):
    glClearColor(0.1, 0.1, 0.5, 0.1)
    glClearDepth(1.0)
    glEnable(GL_DEPTH_TEST)
    glShadeModel(GL_SMOOTH)
    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
    camera.move(0.0, 1.3, 0.0)
    camera.setthree(True)
    camera.length = 3
    global shaderall