Hi LispNYC/cl-opengl-devel!
I just released a new Common Lisp program that I quickly hacked for a school assignment and have since cleaned up a bit. We were supposed to use C but I, of course, used lisp. :)
It's a fancy 3D, interacive viewer for molecules using the OpenGL graphics libraries and the awesome cl-opengl bindings. Currently included molecules: water, ethanol.
Read more about it and download it here:
I was wondering if anyone can confirm this works for them on whatever environments or has any other comments. Also, cl-opengl-devel: feel free to include it as an example with the bindings if you feel it will help anyone!
The random walk framerate testing mode is neat. The code is also good for getting an intuitive feeling for how GL lighting works as well as a good example of using rotation matrices in CL (gl:with-pushed-matrix is brilliant).
But as the blog post concludes: The next generation of this program will not be a way to view molecules, but instead a way of interactively exploring diverse types polyhedron, like, for instance, the icosahedron and the infinite class of anti-prisms. And don't forget that every polyhedron has a dual (where the centre of each face becomes a vertex). Flipping between a polyhedron and its dual in real-time will be sweet.
Doug Hoyte Chief Operating Officer HCSW Silicon Graphics Division
Hello Doug,
Sorry for the very late reply.
On 04/09/2007, doug@hcsw.org doug@hcsw.org wrote:
I was wondering if anyone can confirm this works for them on whatever environments or has any other comments. Also, cl-opengl-devel: feel free to include it as an example with the bindings if you feel it will help anyone!
Works for me with SBCL/1.0.12 running on OSX/ppc. I only had to make a minor adjustment due to a minor incompatibility between current cl-opengl and the cl-opengl-thomas branch I'm using. The first comment that pops to my mind is: finally, a cl-opengl program that is actually useful. (I have only done redbook examples and a silly game so far. :-))
I've added your program to the examples directory. We probably should give it some sort of licence. Is BSD (the same as the rest of cl-opengl) OK with you?
The random walk framerate testing mode is neat. The code is also good for getting an intuitive feeling for how GL lighting works as well as a good example of using rotation matrices in CL (gl:with-pushed-matrix is brilliant).
Yeah, with-pushed-matrix is such a trivial abstraction/utility yet works so nicely.
On Wed, Dec 19, 2007 at 12:59:47PM +0000 or thereabouts, Lu?s Oliveira wrote:
Works for me with SBCL/1.0.12 running on OSX/ppc.
Thanks that is good to hear!
I've added your program to the examples directory. We probably should give it some sort of licence. Is BSD (the same as the rest of cl-opengl) OK with you?
Sure, that is fine with me. For some reason I thought cl-opengl was GPL. I've updated the header of my copy to put it under BSD:
http://hcsw.org/downloads/molview.lisp
Best wishes,
Doug
I think if you changed your mouse code a tad it wouldn't cons so much while mousing;
(defvar origclick (cons 0 0)) (defvar origrot (cons 0.0 0.0))
(defmethod glut:mouse ((window mol-window) button state x y) (when (eq button :left-button) (when (eq state :down) (setf (car origrot) view-rotx (cdr origrot) view-roty (car origclick) x (cdr origclick) y))))
I didn't test the above code at all but it should work and apologies for any formatting nastiness that gmail might add. Finally, you'll have to change all the cadr references to cdr for all the methods using origclick and origrot
Charlie Mac
Hi Charlie,
On Thu, Dec 20, 2007 at 08:11:40AM +0900 or thereabouts, Charlie McMackin wrote:
I think if you changed your mouse code a tad it wouldn't cons so much while mousing;
Good point. It would be interesting to see if this optimisation causes improved frame rates. I will put this on my (unfortunately quite lengthy) TODO list.
Best,
Doug
cl-opengl-devel@common-lisp.net