def initgl () : # # init window # foreground () keepaspect (1, 1) prefposition (100, 500, 100, 500) w = winopen ('flying objects') keepaspect (1, 1) winconstraints () # # configure pipline # doublebuffer () shademodel (GOURAUD) zbuffer (1) RGBmode () gconfig () # # init lighting # light.bindlight (1) # # set viewing # lookat (0.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0)
def cbmaterial (a) : # if mater[0] = 0 : return # p = a.back mater [0][5:8] = [p.diffR.val, p.diffG.val, p.diffB.val] mater [0][1:4] = [p.specR.val, p.specG.val, p.specB.val] mater [0][9:10] = [128.0 * p.shine.val] light.bindlight (0)
mater [0][9:10] = [128.0 * p.shine.val] light.bindlight (0) def cblight (a) : # if licht[0] = 0 : return # p = a.back licht [0][1:4] = [p.R.val, p.G.val, p.B.val] licht [0][5:8] = [20.0 * p.X.val - 10.0, 20.0 * p.Y.val - 10.0, 20.0 * p.Z.val - 10.0] if p.local.val = 0.0 : licht [0][8:9] = [0.0] else: licht [0][8:9] = [1.0] # light.bindlight (0) # # initgl : initialize window, pipeline, light, viewing # def initgl () : # # init window # foreground () keepaspect (1, 1) prefposition (100, 500, 100, 500) w = winopen ('flying objects') keepaspect (1, 1) winconstraints () #