예제 #1
0
파일: main.py 프로젝트: jgerhard/showqMD
    def __init__(self, *args, **kwargs):
        #mouse handling for transforming scene
        self.mouse_down = False
        self.mouse_old = Vec([0., 0.])
        self.rotate = Vec([90., 90., 0.])
        self.translate = Vec([0., 0., 0.])
        self.initrans = Vec([0., 0., -20.])

        self.width = 1024
        self.height = 768

        glutInit(sys.argv)
        glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH)
        glutInitWindowSize(self.width, self.height)
        glutInitWindowPosition(0, 0)
        self.win = glutCreateWindow("The qMD Model")

        #gets called by GLUT every frame
        glutDisplayFunc(self.draw)

        #handle user input
        glutKeyboardFunc(self.on_key)
        glutMouseFunc(self.on_click)
        glutMotionFunc(self.on_mouse_motion)
        
        #this will call draw every 30 ms
        glutTimerFunc(30, self.timer, 30)

        #setup OpenGL scene
        self.glinit()

        #set up initial conditions
        (pos_vbo, col_vbo, vel) = initialize.fountain(maxnum)
        num = len(vel)
        #create our OpenCL instance
        self.cle = physics.Particles(num, dt)
        self.cle.loadData(pos_vbo, col_vbo, vel)

        glutMainLoop()
예제 #2
0
파일: main.py 프로젝트: fean9r/FeaCL
    def __init__(self, *args, **kwargs):
        #mouse handling for transforming scene
        self.mouse_down = False
        self.mouse_old = Vec([0., 0.])
        self.rotate = Vec([0., 0., 0.])
        self.translate = Vec([0., 0., 0.])
        self.initrans = Vec([0., 0., -2.])

        self.width = 640
        self.height = 480

        glutInit(sys.argv)
        glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH)
        glutInitWindowSize(self.width, self.height)
        glutInitWindowPosition(0, 0)
        self.win = glutCreateWindow("Lorenz Attractor")

        #gets called by GLUT every frame
        glutDisplayFunc(self.draw)

        #handle user input
        glutKeyboardFunc(self.on_key)
        glutMouseFunc(self.on_click)
        glutMotionFunc(self.on_mouse_motion)
        
        #this will call draw every 30 ms
        glutTimerFunc(30, self.timer, 30)

        #setup OpenGL scene
        self.glinit()

        #set up initial conditions
        (pos_vbo, col_vbo, vel) = initialize.fountain(num)
        #(pos_vbo, col_vbo, vel) = initialize.initLorenz(num)
        #create our OpenCL instance
        self.cle = part2.Part2(num, dt)
        self.cle.loadData(pos_vbo, col_vbo, vel)

        glutMainLoop()
예제 #3
0
            self.update()
            self.draw()

            clock.tick()
            fps_text.text = "fps: %d" % clock.get_fps()
            fps_text.draw()

            self.flip()



if __name__ == "__main__":

    #set up initial conditions
    (pos_vbo, col_vbo, vel) = initialize.fountain(num)
    #create our OpenCL instance
    example = part2.Part2(num, dt, "part2.cl")
    example.loadData(pos_vbo, col_vbo, vel)


    #setup opengl context with double buffering in pyglet
    from pyglet import gl
    config = gl.Config()
    config.double_buffer=True
    config.depth_size = 16

    #create a window object and run our program!
    p2 = Part2Main(example, resizable=True, config=config)
    #glutil.lights()
    p2.main_loop()
예제 #4
0
            self.dispatch_events()

            self.update()
            self.draw()

            clock.tick()
            fps_text.text = "fps: %d" % clock.get_fps()
            fps_text.draw()

            self.flip()


if __name__ == "__main__":

    #set up initial conditions
    (pos_vbo, col_vbo, vel) = initialize.fountain(num)
    #create our OpenCL instance
    example = part2.Part2(num, dt, "part2.cl")
    example.loadData(pos_vbo, col_vbo, vel)

    #setup opengl context with double buffering in pyglet
    from pyglet import gl
    config = gl.Config()
    config.double_buffer = True
    config.depth_size = 16

    #create a window object and run our program!
    p2 = Part2Main(example, resizable=True, config=config)
    #glutil.lights()
    p2.main_loop()