#======================================== # load model_loadmodel mymodel = Model(file_string='models/Triceratops/Triceratops.egg', name='Triceratops', x=0, y=-1, z=40, sx=0.005, sy=0.005, sz=0.005) mymodel.set_shader(shader) # Fetch key presses mykeys = Keyboard() while 1: DISPLAY.clear() mymodel.draw() mymodel.rotateIncZ(0.001) mymodel.rotateIncX(-0.00317543) mymodel.rotateIncY(0.11) k = mykeys.read() if k >-1: if k==112: screenshot('Triceratops.jpg') elif k==27: mykeys.close() DISPLAY.destroy() break else: print(k) DISPLAY.swap_buffers()
mykeys = Keyboard() # setup matrices mtrx = Matrix() #create a light mylight = Light(0,1,1,1,"",10,10,0) mylight.on() while 1: display.clear() mtrx.identity() mtrx.translate(0,0,-10) mymodel.draw() mymodel.rotateIncY(3.0) k = mykeys.read() if k >-1: if k==112: display.screenshot("teapot.jpg") elif k==27: mykeys.close() texs.deleteAll() display.destroy() break else: print k display.swapBuffers()
x=0, y=-1, z=40, sx=0.005, sy=0.005, sz=0.005) mymodel.set_shader(shader) # Fetch key presses mykeys = Keyboard() while 1: DISPLAY.clear() mymodel.draw() mymodel.rotateIncZ(0.001) mymodel.rotateIncX(-0.00317543) mymodel.rotateIncY(0.11) k = mykeys.read() if k > -1: if k == 112: screenshot('Triceratops.jpg') elif k == 27: mykeys.close() DISPLAY.destroy() break else: print(k) DISPLAY.swap_buffers()
# setup matrices mtrx = Matrix() #create a light mylight = Light(0,1,1,1,"",10,10,0) mylight.on() while 1: display.clear() mtrx.identity() mtrx.translate(0,2,-5) mymodel.draw() mymodel.rotateIncY(1.0) mymodel.rotateIncX(1.3) k = mykeys.read() if k >-1: if k==112: display.screenshot("teapot.jpg") elif k==27: mykeys.close() texs.deleteAll() display.destroy() break else: print k display.swapBuffers()
#======================================== # load bump and reflection textures bumptex = Texture("textures/floor_nm.jpg") shinetex = Texture("textures/stars.jpg") # load model_loadmodel mymodel = Model(file_string='models/teapot.egg', name='teapot', x=0, y=0, z=10) mymodel.set_shader(shader) # material is set in the file mymodel.set_normal_shine(bumptex, 4.0, shinetex, 0.2, is_uv = False) # Fetch key presses mykeys = Keyboard() while DISPLAY.loop_running(): mymodel.draw() mymodel.rotateIncY(2.0) mymodel.rotateIncZ(0.1) mymodel.rotateIncX(0.3) k = mykeys.read() if k >-1: if k == 112: screenshot('teapot.jpg') elif k==27: mykeys.close() DISPLAY.close() break else: print(k)