Re: REPL and OpenGL
A couple of options: - Use coroutines and yield control to the main thread in the glutIdleFunc. - Use a library that doesn't take control of the main loop. I can think of mine ( http://code.google.com/p/libaw/ ) and GLFW ( http://www.glfw.org ). On May 28, 2013, at 10:57 AM, Oskar Wieland wrote: > Hi, > > I'm trying to create an OpenGL window without loosing control to the > "glutMainLoop". > > Thus I added the following definition from glut to OpenGL: > : (de glutMainLoopEvent () (native `*GlutLib "glutMainLoopEvent") ) > > I set up some kind of main loop: > : (mouseFunc '((Btn State X Y) (setq _run NIL))) # Exit upon mouse click > : (de go () (setq _run T)(while _run (glutMainLoopEvent))) > > Is there a function to keep the REPL in the console alive, like > > (de go () (setq _run T)(while _run (glutMainLoopEvent DO_THE_REPL))) > > or is there another (better) way to create a OpenGL window without loosing > control to "glutMainLoop"? > > Oskar > -- > UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
Re: REPL and OpenGL
Hi Oskar, > Thus I added the following definition from glut to OpenGL: > : (de glutMainLoopEvent () (native `*GlutLib "glutMainLoopEvent") ) > > I set up some kind of main loop: > : (mouseFunc '((Btn State X Y) (setq _run NIL))) # Exit upon mouse click > : (de go () (setq _run T)(while _run (glutMainLoopEvent))) > > Is there a function to keep the REPL in the console alive, like > > (de go () (setq _run T)(while _run (glutMainLoopEvent DO_THE_REPL))) > > or is there another (better) way to create a OpenGL window without > loosing control to "glutMainLoop"? I would simply use catch and throw: (mouseFunc '((Btn State X Y) (if (= Btn 1) (throw 'quit) # Stop on middle button press ... do something with other button presses ... ) ) ) (catch 'quit (glutMainLoop)) 'glutMainLoopEvent' might also be useful. Can we find out the socket fd where the events arrive on? If so, then I would trigger 'glutMainLoopEvent' whenever an event arrives: (task (glutMainLoopEvent)) ♪♫ Alex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
REPL and OpenGL
Hi, I'm trying to create an OpenGL window without loosing control to the "glutMainLoop". Thus I added the following definition from glut to OpenGL: : (de glutMainLoopEvent () (native `*GlutLib "glutMainLoopEvent") ) I set up some kind of main loop: : (mouseFunc '((Btn State X Y) (setq _run NIL))) # Exit upon mouse click : (de go () (setq _run T)(while _run (glutMainLoopEvent))) Is there a function to keep the REPL in the console alive, like (de go () (setq _run T)(while _run (glutMainLoopEvent DO_THE_REPL))) or is there another (better) way to create a OpenGL window without loosing control to "glutMainLoop"? Oskar -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe