def on_reshape(width, height): gl.glViewport(0, 0, width, height) u_projection[...] = ortho(0,width,0,height,-1,1)
def reshape(width, height): gl.glViewport(0, 0, width, height) projection = ortho(0, width, 0, height, -1, +1) program['u_projection'] = projection
# Build program # -------------------------------------- program = Program(vertex, fragment) program.bind(vertices) # Build view, model, projection & normal # -------------------------------------- view = np.eye(4,dtype=np.float32) rotate(view, 20, 1, 0, 0) translate(view, 0,1 ,-8) model = np.eye(4,dtype=np.float32) projection = np.eye(4,dtype=np.float32) program['model'] = model program['view'] = view program['o_projection'] = ortho(-10, 10, -10, 10, -10, 20) phi, theta = 0,0 program2 = Program(vertex, ilio.read('black.frag'), count=4) program2['model'] = model program2['view'] = view program2["position"] = [[-2,-1, 2],[-2, -1, -2], [2, -1, 2], [2,-1, -2]] depthv = ilio.read('depth.vert') depthf = ilio.read('depth.frag') shadowProgram = Program(depthv, depthf) # shadowProgram.set_shaders(ilio.read('depth.vert'), ilio.read('depth.frag')) shadowProgram['projection'] = ortho(-10, 10, -10, 10, -10, 20) #shadowProgram["position"] = [[-2,-1, 2],[-2, -1, -2], [2, -1, 2], [2,-1, -2]] shadowProgram.bind(vertices)
def reshape(width,height): gl.glViewport(0, 0, width, height) projection = ortho(0, width, 0, height, -1, +1) program['u_projection'] = projection
# Build program # -------------------------------------- program = Program(vertex, fragment) program.bind(vertices) # Build view, model, projection & normal # -------------------------------------- view = np.eye(4, dtype=np.float32) rotate(view, 20, 1, 0, 0) translate(view, 0, 1, -8) model = np.eye(4, dtype=np.float32) projection = np.eye(4, dtype=np.float32) program['model'] = model program['view'] = view program['o_projection'] = ortho(-10, 10, -10, 10, -10, 20) phi, theta = 0, 0 program2 = Program(vertex, ilio.read('black.frag'), count=4) program2['model'] = model program2['view'] = view program2["position"] = [[-2, -1, 2], [-2, -1, -2], [2, -1, 2], [2, -1, -2]] depthv = ilio.read('depth.vert') depthf = ilio.read('depth.frag') shadowProgram = Program(depthv, depthf) # shadowProgram.set_shaders(ilio.read('depth.vert'), ilio.read('depth.frag')) shadowProgram['projection'] = ortho(-10, 10, -10, 10, -10, 20) #shadowProgram["position"] = [[-2,-1, 2],[-2, -1, -2], [2, -1, 2], [2,-1, -2]] shadowProgram.bind(vertices)