def paint_with_texture(): test = OpenGl() test.glInit(output_dir='out/sr5', flag_texture=True) test.glCreateWindow(500, 500) test.glViewPort(0, 0, 500, 500) test.glColor(1, 1, 1) # test.glOpenModel('models/batmobile.obj', 'models/batmobile.bmp', (250, 10, 0), (10, 10, 10)) # test.glOpenModel('models/batman.obj', 'models/batman.bmp', (250, 0, 0), (100, 100, 50)) test.glOpenModel('models/sphere.obj', 'models/sphere.bmp', (250, 250, 0), (100, 100, 50)) # test.glOpenModel('models/face.obj', 'models/face.bmp', (200, -250, 10), (200, 200, 50)) # test.glOpenModel('batman2.obj', 'texture-2.bmp', (300, -100, 10), (50, 100, 50)) test.glFinish()
def test_line(): test = OpenGl() test.glInit() test.glCreateWindow(300, 300) test.glViewPort(0, 0, 300, 300) test.glColor(1, 1, 1) test.glVertex(random.random(), random.random()) test.glFinish()
def test_line(): test = OpenGl() test.glInit(output_dir='out/sr2', name='sr2.bmp') test.glCreateWindow(300, 300) test.glViewPort(0, 0, 300, 300) test.glColor(1, 1, 1) test.glLine(0, 0, -1, -1) test.glLine(-1, 1, 0, -1) test.glLine(1, -1, 0, 0) test.glFinish()
def fill_polygon(): test = OpenGl() test.glInit( output_dir='out/lab1', name='image', ) test.glCreateWindow(800, 500) test.glViewPort(0, 0, 800, 500) test.glColor(1, 1, 1) test.glFillPolygon([(165, 380), (185, 360), (180, 330), (207, 345), (233, 330), (230, 360), (250, 380), (220, 385), (205, 410), (193, 383)]) test.glFillPolygon([(321, 335), (288, 286), (339, 251), (374, 302)]) test.glFillPolygon([(377, 249), (411, 197), (436, 249)]) test.glFillPolygon([(413, 177), (448, 159), (502, 88), (553, 53), (535, 36), (676, 37), (660, 52), (750, 145), (761, 179), (672, 192), (659, 214), (615, 214), (632, 230), (580, 230), (597, 215), (552, 214), (517, 144), (466, 180)]) test.glColor(0, 0, 0) test.glFillPolygon([(682, 175), (708, 120), (735, 148), (739, 170)]) test.glFinish()
def gen_zbuffer(): test = OpenGl() test.glInit(output_dir='out/sr4', name='image', flag_zbuffer=True) test.glCreateWindow(300, 300) test.glViewPort(0, 0, 300, 300) test.glColor(1, 1, 1) test.glOpenModel('cube3.obj', translate=(100, 100, 0), scale=(50, 50, 50)) test.glFinish()
def transformations(): # test = OpenGl() # test.glInit(output_dir='out/sr6', name='image', trans_flag=True) # test.glCreateWindow(500, 500) # test.glViewPort(0, 0, 500, 500) # test.glColor(1, 1, 1) # test.glOpenModel('models/sphere.obj', translate=(0, 0, 0), scale=(0.5, 0.5, 0.5), shader=gouraud) # test.glFinish() # test = OpenGl() # test.glInit(output_dir='out/sr6', name='medium_shot', trans_flag=True) # test.glCreateWindow(500, 500) # test.glViewPort(0, 0, 500, 500) # test.glColor(1, 1, 1) # test.glOpenModel('models/batman.obj', translate=(0, -0.6, 0), scale=(0.4, 0.4, 0.4), rotate=(0, 0, 0)) # test.glFinish() test = OpenGl() test.glInit(output_dir='out/sr6', name='dutch_angle', trans_flag=True) test.glCreateWindow(500, 500) test.glViewPort(0, 0, 500, 500) test.glColor(1, 1, 1) test.glOpenModel('models/batman.obj', translate=(-1.2, -1.3, 0), scale=(0.7, 0.7, 0.7), rotate=(0, 0, -0.8)) test.glFinish()
def test_model(): test = OpenGl() test.glInit(output_dir='out/sr3', name='image',) test.glCreateWindow(300, 300) test.glViewPort(50, 50, 200, 200) test.glColor(1, 1, 1) test.glOpenModel('cube3.obj', translate=(150, 150, 0), scale=(50, 50, 50)) test.glFinish()
def shaders(): test = OpenGl() test.glInit(output_dir='out/lab3', name='image', trans_flag=True) test.glCreateWindow(500, 500) test.glViewPort(0, 0, 500, 500) test.glColor(1, 1, 1) test.glOpenModel('models/ball.obj', translate=(0, 0, 0), scale=(0.5, 0.5, 0.5), shader=planet_shader) test.glFinish()
def project(): test = OpenGl() test.glInit(output_dir='out/project', name='image', trans_flag=True) test.glCreateWindow(image='models/background.bmp') # test.glCreateWindow(500, 500) test.glViewPort(0, 0, 500, 500) test.glColor(0, 0, 0) test.glOpenModel('models/batman3.obj', translate=(1.5, -0.7, -20), scale=(0.35, 0.35, 0.35), rotate=(0.2, -0.2, 0), shader=batman_shader) test.glColor(1, 1, 1) test.glOpenModel('models/batarang.obj', translate=(0.6, -0.2, 10), scale=(0.006, 0.006, 0.006), rotate=(-0.6, 1.2, -0.3), shader=batarang_shader) test.glOpenModel('models/batmobile.obj', 'models/batmobile.bmp', translate=(2.5, -0.5, -30), scale=(0.16, 0.16, 0.16), rotate=(0.12, 0.6, -0.03), shader=batmobile_shader) test.glOpenModel('models/joker.obj', 'models/joker.bmp', translate=(-0.2, -1.8, 16), scale=(0.2, 0.2, 0.2), rotate=(0, 3, 0)) test.glFinish()