From k2msmith at gmail.com Thu Jul 15 19:27:13 2010 From: k2msmith at gmail.com (Kevin Smith) Date: Thu, 15 Jul 2010 12:27:13 -0700 Subject: [cl-opengl-devel] threaded glut main loop Message-ID: Has anyone gotten glut:main-loop to work in it's own thread ? I'd like to be able to asynchronously execute opengl calls while the main loop is running. I have a bit of a hack that can do this in effect, by calling glut:leave-main-loop inside a callback, going the repl and running list and then manually starting the mainloop again to refresh, but it would be nice to use threaded main loop. I'm using sbcl on mac OS, so I am not even sure if threading is going to work. -------------- next part -------------- An HTML attachment was scrubbed... URL: From biolizard.mail at gmail.com Sun Jul 18 20:17:19 2010 From: biolizard.mail at gmail.com (=?ISO-8859-1?Q?Jos=E9_Lopes?=) Date: Sun, 18 Jul 2010 21:17:19 +0100 Subject: [cl-opengl-devel] build-2d-mipmaps Message-ID: <4C43614F.5000603@gmail.com> Hi, I was trying to create textures using glu:build-2d-mipmaps (I also tried using gl:tex-image-2d) and I had a few problems. I'm using jpeg:decode-image which produces a vector of unsigned bytes from the image that it loads. However, the function build-2d-mipmaps cannot handle properly a vector of data (or so I think). So I had to use cffi:with-foreign-pointer to allocate memory and copy all the bytes from the image to a cffi pointer so that it could be passed correctly to the underlying cffi layer through build-2d-mipmaps. This is the code I have now (defmethod glut:display-window :before ((window texture-window)) (gl:clear-color 0 0 0 0) (gl:shade-model :flat) (multiple-value-bind (data height width channels) (jpeg:decode-image "/home/joe/tux.jpg") (let ((texture (first (gl:gen-textures 1)))) (gl:bind-texture :texture-2d texture) (setf (texture window) texture) (gl:tex-env :texture-env :texture-env-mode :modulate) (gl:tex-parameter :texture-2d :texture-min-filter :linear-mipmap-linear) (gl:tex-parameter :texture-2d :texture-mag-filter :linear) (gl:tex-parameter :texture-2d :texture-wrap-s :repeat) (gl:tex-parameter :texture-2d :texture-wrap-t :repeat) (cffi:with-foreign-pointer (buf (* width height channels)) (loop for i from 0 below (* width height channels) do (setf (cffi:mem-ref buf :char i) (aref data i))) (glu:build-2d-mipmaps :texture-2d :rgb width height :bgr :unsigned-byte buf))))) I would like to avoid cffi calls. Do you have any suggestion? Regards, Jos? Lopes -------------- next part -------------- An HTML attachment was scrubbed... URL: