示例#1
0
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()
示例#2
0
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()
示例#3
0
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()
示例#4
0
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()
示例#5
0
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()
示例#6
0
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()