Пример #1
0
def test2():
    w, h = 600, 480 
    def glutSwapBuffers(): pass
    sdk = OglSdk(w, h, glutSwapBuffers)
    sdk.load_file('test/data/gears.obj')

    print sdk.scene.views[0]
    sdk.pointer_move('rotate', 100, 120, 110, 130)
    print sdk.scene.views[0]
Пример #2
0
def test2():
    w, h = 600, 480

    def glutSwapBuffers():
        pass

    sdk = OglSdk(w, h, glutSwapBuffers)
    sdk.load_file('test/data/gears.obj')

    print sdk.scene.views[0]
    sdk.pointer_move('rotate', 100, 120, 110, 130)
    print sdk.scene.views[0]
Пример #3
0
    glutTimerFunc(1, void, 0)
    glutMainLoop()


class Anim():
    def __init__(self):
        files = sys.argv[1:]
        self.frame = 0
        from scene import load
        self.scenes = [sdk.load_file(f) for f in files]

    def next_scene(self):
        N = len(self.scenes)
        self.frame = (self.frame + 1) % N

        return self.scenes[self.frame]


if __name__ == '__main__':

    # Window dimensions
    w, h = 600, 480

    from viewer import OglSdk
    sdk = OglSdk(w, h, glutSwapBuffers)

    anim = Anim()

    glut_main(w, h)
Пример #4
0
                )  # dont call update twice if we are manipulating too

    def wheelEvent(self, event):
        direction = 1 if event.delta() > 0 else -1
        sdk.pointer_move('zoom', 0, 0, direction * 100, direction * 100)

        self.updateGL()


if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)

    from scene import ArgsOptions
    ao = ArgsOptions()

    window = Window(ao.options.verbose)

    # Set files
    options = [ao.options.fn, ao.options.verbose]

    # Window dimensions
    w, h = 250, 250

    from viewer import OglSdk
    sdk = OglSdk(w, h, window.glWidget.swapBuffers)
    window.sdkLoadFile(options)

    # Start display
    window.show()
    sys.exit(app.exec_())
Пример #5
0
    glutInitWindowSize(sdk.w, sdk.h)
    glutInitWindowPosition(100, 100)
    glutCreateWindow(window_title)

    glutKeyboardFunc(ogl_processNormalKeys)

    # Mouse
    glutMouseFunc(ogl_mouse);
    glutMotionFunc(ogl_motion);

    glutDisplayFunc(ogl_display)
    glutReshapeFunc(ogl_reshape)

    glutMainLoop()

if __name__ == '__main__':

    ao = ArgsOptions()
    options = [ao.options.fn,
               ao.options.verbose,
               ao.options.procedural]

    # Window dimensions
    w, h = 600, 480 

    from viewer import OglSdk
    sdk = OglSdk(w, h, glutSwapBuffers)
    sdk.load_file(*options)

    glut_main(w, h)