Esempio n. 1
0
    glut.glutInit(sys.argv)
    glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB
                             | glut.GLUT_DEPTH)
    glut.glutInitWindowSize(800, 800)
    glut.glutCreateWindow("Antialiased thick polylines")
    glut.glutDisplayFunc(on_display)
    glut.glutReshapeFunc(on_reshape)
    glut.glutKeyboardFunc(on_keyboard)
    glut.glutIdleFunc(on_idle)

    t0, frames, t = 0, 0, 0
    t0 = glut.glutGet(glut.GLUT_ELAPSED_TIME)

    atlas = DashAtlas()
    collection = LineCollection(atlas)
    vertices = star(n=5)
    collection.append(vertices,
                      color=(0, 0, 0, 1),
                      linewidth=20,
                      translate=(400, 400),
                      scale=350,
                      dash_pattern='densely dashed',
                      dash_caps=('>', '<'))
    collection.append(vertices,
                      color=(0, 0, 0, 1),
                      linewidth=20,
                      translate=(400, 400),
                      scale=250,
                      dash_pattern='dotted',
                      dash_caps=('(', ')'))
Esempio n. 2
0
    import OpenGL.GLUT as glut
    from glagg.dash_atlas import DashAtlas
    from shapes import star, asterisk
    from glagg.line_collection import LineCollection

    glut.glutInit(sys.argv)
    glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB | glut.GLUT_DEPTH)
    glut.glutInitWindowSize(600, 256)
    glut.glutCreateWindow("Antialiased thick polylines")
    glut.glutDisplayFunc(on_display)
    glut.glutReshapeFunc(on_reshape)
    glut.glutKeyboardFunc(on_keyboard)

    atlas = DashAtlas()
    vertices = np.array([(+0.0, +0.5), (+0.0, -0.5)])
    collection = LineCollection(atlas)
    for i in range(68):
        color = 0, 0, 0, 1
        linewidth = 0.1 + i * 0.1
        scale = 200
        theta = -5 * np.pi / 180
        translate = 32 + i * 8, 128
        collection.append(
            [(0.0, -0.5), (0.0, +0.5)],
            linewidth=linewidth,
            color=color,
            scale=scale,
            rotate=theta,
            translate=translate,
            dash_pattern="dotted",
        )
Esempio n. 3
0
if __name__ == '__main__':
    import sys
    import OpenGL.GLUT as glut
    from glagg.dash_atlas import DashAtlas
    from shapes import star, asterisk
    from glagg.line_collection import LineCollection

    glut.glutInit(sys.argv)
    glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB | glut.GLUT_DEPTH)
    glut.glutInitWindowSize(800, 800)
    glut.glutCreateWindow("Antialiased thick polylines")
    glut.glutDisplayFunc(on_display)
    glut.glutReshapeFunc(on_reshape)
    glut.glutKeyboardFunc(on_keyboard)
    glut.glutIdleFunc(on_idle)

    t0, frames, t = 0,0,0
    t0 = glut.glutGet(glut.GLUT_ELAPSED_TIME)

    atlas = DashAtlas()
    collection = LineCollection(atlas)
    vertices = star(n=5)
    collection.append( vertices, color=(0,0,0,1),
                       linewidth=20, translate=(400,400), scale=350,
                       dash_pattern = 'densely dashed',
                       dash_caps=('>','<') )
    collection.append( vertices, color=(0,0,0,1),
                       linewidth=20, translate=(400,400), scale=250,
                       dash_pattern = 'dotted', dash_caps=('(',')') )
    glut.glutMainLoop()
Esempio n. 4
0
    from glagg.dash_atlas import DashAtlas
    from shapes import star, asterisk
    from glagg.line_collection import LineCollection

    glut.glutInit(sys.argv)
    glut.glutInitDisplayMode(glut.GLUT_DOUBLE | glut.GLUT_RGB
                             | glut.GLUT_DEPTH)
    glut.glutInitWindowSize(600, 256)
    glut.glutCreateWindow("Antialiased thick polylines")
    glut.glutDisplayFunc(on_display)
    glut.glutReshapeFunc(on_reshape)
    glut.glutKeyboardFunc(on_keyboard)

    atlas = DashAtlas()
    vertices = np.array([(+0.0, +0.5), (+0.0, -0.5)])
    collection = LineCollection(atlas)
    for i in range(68):
        color = 0, 0, 0, 1
        linewidth = .1 + i * .1
        scale = 200
        theta = -5 * np.pi / 180
        translate = 32 + i * 8, 128
        collection.append([(0.0, -0.5), (0.0, +0.5)],
                          linewidth=linewidth,
                          color=color,
                          scale=scale,
                          rotate=theta,
                          translate=translate,
                          dash_pattern='dotted')
    glut.glutMainLoop()