From: Emre Sevinc
Subject: Stupid binary clock
Date: 
Message-ID: <87irwqcu3b.fsf@ileriseviye.org>
When I first a real binary clock at ThinkGeek
I was excited:

http://www.thinkgeek.com/cubegoodies/lights/59e0/

Years ago, I did a very simple JavaScript application
put some radiobuttons, arranged them so that I had
a simple binary clock in my browser.

Then somehow I lost the source code.

Last Wednesday, when I was on TV show, we had
a special guest from USA, visiting Turkey and
he showed a binary wristwatch in action!

http://www.thinkgeek.com/gadgets/watches/6a17/

I said to myself, well, this can be simulated
in JScript, this can look cool in Flash but
why not do a simple-stupid-ascii-primitive
Common Lisp trial?

So, in order to have 5 minute CL daily exercise
I've written (minutes spent to leard forced/finished
output doesn't count :))

(defun binary-clock () (loop (bc) (sleep 1) (force-output)))

(defun bc ()
  (multiple-value-bind (second minute hour) (get-decoded-time)
    (format t "As time goes by one by one...~%")
    (format t "~4,'0b~%~4,'0b~%~4,'0b~%~4,'0b~%~4,'0b~%~4,'0b~%~%" 
	    (floor (/ hour 10.0)) (rem hour 10)
	    (floor (/ minute 10.0)) (rem minute 10)
	    (floor (/ second 10.0)) (rem second 10))))

Nothing much, just to have some very simple multiple value, format,
arithmetic exercise to have each and every second:

CL-USER> (binary-clock)
As time goes by one by one...
0001
1001
0000
1001
0001
0010

As time goes by one by one...
0001
1001
0000
1001
0001
0011

As time goes by one by one...
0001
1001
0000
1001
0001
0100

As time goes by one by one...
0001
1001
0000
1001
0001
0101

; Evaluation aborted
CL-USER> 


Maybe if the output matrix is transposed and some _s
and Os used it can look cooler, or maybe it can
be implemented using CLIM or some kind of GTK
binding to have a small graphics window ticking
slowly in some corner of the screen.

And yes, maybe the code can better, optimized,
etc.

I don't know why Lisp is starting to look more
and more "natural" to me everyday, maybe my
point of view is getting a bit biased, skewed.

Happy hacking,

PS: Heh, if I or some other Lisp enthusiast can 
make a small hack and create a small-window-but-graphical
binary clock application in Lisp, maybe I'll have another
chance to talk about Lisp on TV :)

Oh, yes, somebody did something on SourceForge
(how could it be otherwise! :))

http://binary-clock.sourceforge.net/

-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr

From: Pascal Bourguignon
Subject: Re: Stupid binary clock
Date: 
Message-ID: <87mzm2noqh.fsf@thalassa.informatimago.com>
Emre Sevinc <·····@bilgi.edu.tr> writes:
> (defun binary-clock () (loop (bc) (sleep 1) (force-output)))
>
> (defun bc ()
>   (multiple-value-bind (second minute hour) (get-decoded-time)
>     (format t "As time goes by one by one...~%")
>     (format t "~4,'0b~%~4,'0b~%~4,'0b~%~4,'0b~%~4,'0b~%~4,'0b~%~%" 
> 	    (floor (/ hour 10.0)) (rem hour 10)
> 	    (floor (/ minute 10.0)) (rem minute 10)
> 	    (floor (/ second 10.0)) (rem second 10))))

(defun bc ()
  (multiple-value-bind (second minute hour) (get-decoded-time)
    (format t "As time goes by one by one...~%")
    (format t ··@{~4,'0b~%~}~%"
	    (truncate hour 10) (mod hour 10)
	    (truncate minute 10) (mod minute 10)
	    (truncate second 10) (mod second 10))))

·@{ ~} takes all the remaining arguments.
TRUNCATE gives directly what you want.
I prefer MOD since it will always give positive numbers.



(defun format-bits (stream argument colon-p at-p &rest prefix)
  (declare (ignore at-p))
  (destructuring-bind (width &optional (one #\o) (zero #\-) (sep #\-) &rest rest)
      prefix
    (declare (ignore rest))
    (flet ((digit (i)  (if (oddp (ldb (byte 1 i) argument)) one zero)))
      (if colon-p
          (loop for i from (1- width) downto 1
             do (princ (digit i) stream) (princ sep stream)
             finally (princ (digit 0) stream))
          (loop for i from (1- width) downto 0
             do  (princ (digit i) stream))))))


(defun bc ()
  (multiple-value-bind (second minute hour) (get-decoded-time)
    (format t "As time goes by one by one...~%")
    (format t ··@{~4:/format-bits/~%~}~%"
	    (truncate hour 10) (mod hour 10)
	    (truncate minute 10) (mod minute 10)
	    (truncate second 10) (mod second 10))))

> (bc)
As time goes by one by one...
----o--
----o-o
----o--
----o--
-------
--o-o--



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein
From: Emre Sevinc
Subject: Re: Stupid binary clock
Date: 
Message-ID: <8764sqceat.fsf@ileriseviye.org>
Pascal Bourguignon <····@mouse-potato.com> writes:

> Emre Sevinc <·····@bilgi.edu.tr> writes:
>> (defun binary-clock () (loop (bc) (sleep 1) (force-output)))
>>
>> (defun bc ()
>>   (multiple-value-bind (second minute hour) (get-decoded-time)
>>     (format t "As time goes by one by one...~%")
>>     (format t "~4,'0b~%~4,'0b~%~4,'0b~%~4,'0b~%~4,'0b~%~4,'0b~%~%" 
>> 	    (floor (/ hour 10.0)) (rem hour 10)
>> 	    (floor (/ minute 10.0)) (rem minute 10)
>> 	    (floor (/ second 10.0)) (rem second 10))))
>
> ·@{ ~} takes all the remaining arguments.
> TRUNCATE gives directly what you want.
> I prefer MOD since it will always give positive numbers.
>
>
>
> (defun format-bits (stream argument colon-p at-p &rest prefix)
>   (declare (ignore at-p))
>   (destructuring-bind (width &optional (one #\o) (zero #\-) (sep #\-) &rest rest)
>       prefix
>     (declare (ignore rest))
>     (flet ((digit (i)  (if (oddp (ldb (byte 1 i) argument)) one zero)))
>       (if colon-p
>           (loop for i from (1- width) downto 1
>              do (princ (digit i) stream) (princ sep stream)
>              finally (princ (digit 0) stream))
>           (loop for i from (1- width) downto 0
>              do  (princ (digit i) stream))))))


I think a fairly advanced use of format is happening
here. (First time I see such a complicated function 
to be used in a format control string, I must check
out Seibel's format recipes again).

Time to go and refresh my knowledge and learn something
by consulting my books.

Thanks for giving me the opportunity to learn more.

I'll also try to find out if it the same effect
can be realized using a simpler scheme, maybe writing
to a string using with-output-to-string and then
printing it.



-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr
From: Pascal Bourguignon
Subject: Re: Stupid binary clock
Date: 
Message-ID: <87br2inlk9.fsf@thalassa.informatimago.com>
Emre Sevinc <·····@bilgi.edu.tr> writes:
>> (defun format-bits (stream argument colon-p at-p &rest prefix)
>> [...]
>
> I think a fairly advanced use of format is happening
> here. (First time I see such a complicated function 
> to be used in a format control string, I must check
> out Seibel's format recipes again).
>
> Time to go and refresh my knowledge and learn something
> by consulting my books.
>
> Thanks for giving me the opportunity to learn more.
>
> I'll also try to find out if it the same effect
> can be realized using a simpler scheme, maybe writing
> to a string using with-output-to-string and then
> printing it.

Of course, if you have only one use  for such a format it would be
silly to design it this way.  But you can can use format-bits
directly if you want, so since you'd have to write it anyway, you can
as well use this function signature to be able eventually to use it as
a format specifier.

The interesting part is actually: (format t ··@{~4:/format-bits/~%~}~%" ...)
where we can see some more abstracting in action.  
If you had to use it a lot in an application.



-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS d? s++:++ a+ C+++ UL++++ P--- L+++ E+++ W++ N+++ o-- K- w--- 
O- M++ V PS PE++ Y++ PGP t+ 5+ X++ R !tv b+++ DI++++ D++ 
G e+++ h+ r-- z? 
------END GEEK CODE BLOCK------
From: nabla
Subject: Re: Stupid binary clock
Date: 
Message-ID: <4324c$4338613c$540a2bbf$4726@news.chello.pl>
Emre Sevinc napisał(a):

> Happy hacking,
> 
> PS: Heh, if I or some other Lisp enthusiast can 
> make a small hack and create a small-window-but-graphical
> binary clock application in Lisp, maybe I'll have another
> chance to talk about Lisp on TV :)

http://common-lisp.net/~rstrzalinski/binary-clock-app.lisp

This is my simple binary clock. It uses opengl (via cl-sdl package).

Enjoy.

-- 
Best regards,
Rafal Strzalinski (nabla)
From: Emre Sevinc
Subject: Re: Stupid binary clock
Date: 
Message-ID: <87slvrbjhk.fsf@ileriseviye.org>
nabla <···············@nospam.gmail.com> writes:

> Emre Sevinc napisa�(a):
>
>> Happy hacking,
>> PS: Heh, if I or some other Lisp enthusiast can make a small hack
>> and create a small-window-but-graphical
>> binary clock application in Lisp, maybe I'll have another
>> chance to talk about Lisp on TV :)
>
> http://common-lisp.net/~rstrzalinski/binary-clock-app.lisp
>
> This is my simple binary clock. It uses opengl (via cl-sdl package).

I really wondered how it will look on my system, so first I did
an apt-get:

apt-get install cl-sdl-opengl

and it ran fine on my Debian GNU/Linux (unstable), installing cl-sdl, too.
Then I copy-pasted your code and tried to compile it with SBCL 0.9.2
but it gave me these errors and warnings:

;;;; Compile file /home/fz/programming/Lisp/binary-clock-opengl.l ...

; compiling file "/home/fz/programming/Lisp/binary-clock-opengl.lisp" (written 27 SEP 2005 12:26:38 AM):
; loading system definition from #P"/usr/share/common-lisp/systems/opengl.asd"
; into #<PACKAGE "ASDF6">
; registering #<SYSTEM OPENGL {908F049}> as OPENGL
; loading system definition from #P"/usr/share/common-lisp/systems/sdl-ffi.asd"
; into #<PACKAGE "ASDF8">
; registering #<SYSTEM SDL-FFI {9240C31}> as SDL-FFI
; loading system definition from #P"/usr/share/common-lisp/systems/uffi.asd"
; into #<PACKAGE "ASDF10">
; registering #<SYSTEM UFFI {93ECD49}> as UFFI
; loading system definition from #P"/usr/share/common-lisp/systems/sdl.asd"
; into #<PACKAGE "ASDF16">
; registering #<SYSTEM SDL {96CD3B1}> as SDL
; compiling file "/usr/share/common-lisp/source/uffi/src/strings.lisp" (written 25 JUN 2004 04:18:50 AM):
; in: LAMBDA NIL
;     (LET* ((UFFI::OBJ (CAR (CDR #:WHOLE40)))
;          (LENGTH
;           (IF (SB-KERNEL::KEYWORD-SUPPLIED-P :LENGTH #:KEYWORDS-42)
;               (SB-KERNEL::LOOKUP-KEYWORD :LENGTH #:KEYWORDS-42)
;               NIL))
;          (UFFI::LOCALE
;           (IF #:SUPPLIEDP-43
;               (SB-KERNEL::LOOKUP-KEYWORD ':LOCALE #:KEYWORDS-42)
;               :DEFAULT))
;          (UFFI::NULL-TERMINATED-P
;           (IF #:SUPPLIEDP-44
;               (SB-KERNEL::LOOKUP-KEYWORD ':NULL-TERMINATED-P #:KEYWORDS-42)
;               T)))
;     (BLOCK UFFI:CONVERT-FROM-FOREIGN-STRING
;       `(IF (UFFI:NULL-POINTER-P ,UFFI::OBJ)
;            ,NIL
;            (UFFI::SBCL-NATURALIZE-CSTRING (ALIEN-SAP ,UFFI::OBJ)
;                                           :LENGTH
;                                           ,LENGTH
;                                           :NULL-TERMINATED-P
;                                           ,UFFI::NULL-TERMINATED-P))))
; 
; caught STYLE-WARNING:
;   The variable LOCALE is defined but never used.

; file: /usr/share/common-lisp/source/uffi/src/strings.lisp
; in: DEFMACRO CONVERT-FROM-FOREIGN-STRING
;     (DEFMACRO UFFI:CONVERT-FROM-FOREIGN-STRING
;             (UFFI::OBJ
;              &KEY LENGTH (UFFI::LOCALE :DEFAULT) (UFFI::NULL-TERMINATED-P T))
;     `(IF (UFFI:NULL-POINTER-P ,UFFI::OBJ)
;          ,NIL
;          (UFFI::SBCL-NATURALIZE-CSTRING (ALIEN-SAP ,UFFI::OBJ)
;                                         :LENGTH
;                                         ,LENGTH
;                                         :NULL-TERMINATED-P
;                                         ,UFFI::NULL-TERMINATED-P)))
; --> EVAL-WHEN SB-C::%DEFMACRO SB-C::%DEFMACRO FUNCTION LET* 
; ==>
;   (LET* ((UFFI::OBJ (CAR (CDR #:WHOLE40)))
;          (LENGTH
;           (IF (SB-KERNEL::KEYWORD-SUPPLIED-P :LENGTH #:KEYWORDS-42)
;               (SB-KERNEL::LOOKUP-KEYWORD :LENGTH #:KEYWORDS-42)
;               NIL))
;          (UFFI::LOCALE
;           (IF #:SUPPLIEDP-43
;               (SB-KERNEL::LOOKUP-KEYWORD ':LOCALE #:KEYWORDS-42)
;               :DEFAULT))
;          (UFFI::NULL-TERMINATED-P
;           (IF #:SUPPLIEDP-44
;               (SB-KERNEL::LOOKUP-KEYWORD ':NULL-TERMINATED-P #:KEYWORDS-42)
;               T)))
;     (BLOCK UFFI:CONVERT-FROM-FOREIGN-STRING
;       `(IF (UFFI:NULL-POINTER-P ,UFFI::OBJ)
;            ,NIL
;            (UFFI::SBCL-NATURALIZE-CSTRING (ALIEN-SAP ,UFFI::OBJ)
;                                           :LENGTH
;                                           ,LENGTH
;                                           :NULL-TERMINATED-P
;                                           ,UFFI::NULL-TERMINATED-P))))
; 
; caught STYLE-WARNING:
;   The variable LOCALE is defined but never used.
; compilation aborted after 0:00:00
; 
; compilation unit aborted
;   caught 3 fatal ERROR conditions
;   caught 2 STYLE-WARNING conditions
; compilation aborted after 0:00:01



Any suggestions? What should I check? Do I need to upgrade
some packages for Debian GNU/Linux?

This is the first time I try Lisp+OpenGL, maybe I forgot
to install or setup something.

Happy hacking,

-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr
From: Emre Sevinc
Subject: Re: Stupid binary clock
Date: 
Message-ID: <87oe6fbik5.fsf@ileriseviye.org>
nabla <···············@nospam.gmail.com> writes:

> Emre Sevinc napisa�(a):
>
>> Happy hacking,
>> PS: Heh, if I or some other Lisp enthusiast can make a small hack
>> and create a small-window-but-graphical
>> binary clock application in Lisp, maybe I'll have another
>> chance to talk about Lisp on TV :)
>
> http://common-lisp.net/~rstrzalinski/binary-clock-app.lisp
>
> This is my simple binary clock. It uses opengl (via cl-sdl package).
>
> Enjoy.

Still can't enjoy it. Upgraded my cl-ufffi (just thinking
it would help):

apt-get install cl-uffi 

and tried to recompile your code without success:


Could not open shared object #S(SB-ALIEN::SHARED-OBJECT
                                :FILE "/usr/lib/libGL.so"
                                :SAP NIL): /usr/lib/libGL.so: cannot open shared object file: No such file or directory
   [Condition of type SIMPLE-ERROR]

Restarts:
  0: [RETRY] Retry performing #<ASDF:COMPILE-OP NIL {923E931}> on #<ASDF:CL-SOURCE-FILE "gl" {9FF7421}>.
  1: [ACCEPT] Continue, treating #<ASDF:COMPILE-OP NIL {923E931}> on #<ASDF:CL-SOURCE-FILE "gl" {9FF7421}> as having been successful.
  2: [ABORT] Abort SLIME compilation.
  3: [ABORT] Abort handling SLIME request.
  4: [TERMINATE-THREAD] Terminate this thread (3046591392)

Backtrace:
  0: (SB-SYS:DLOPEN-OR-LOSE #S(SB-ALIEN::SHARED-OBJECT :FILE "/usr/lib/libGL.so" :SAP NIL))
  1: (SB-ALIEN:LOAD-SHARED-OBJECT "/usr/lib/libGL.so")
  2: (UFFI:LOAD-FOREIGN-LIBRARY "/usr/lib/libGL.so" :MODULE #<unused argument> :SUPPORTING-LIBRARIES #<unused argument> :FORCE-LOAD NIL)
  3: (SDL-GL-UFFI-MACROS:LOAD-DEFINED-FOREIGN-LIBRARY OPENGL:OPENGL)
  4: (SDL-GL-UFFI-MACROS:LOAD-DEFINED-FOREIGN-LIBRARY OPENGL::GLSTUB



A quick check on my /usr/lib/ yields:



··@debian:~/programming/Lisp$ ls -l /usr/lib/libG*
lrwxrwxrwx  1 root root      20 Sep 27 00:22 /usr/lib/libGL.a -> ../X11R6/lib/libGL.a
lrwxrwxrwx  1 root root      21 Jul 23 18:29 /usr/lib/libGLcore.so.1 -> libGLcore.so.1.0.7174
-rwxr-xr-x  1 root root 3623820 Apr  4  2003 /usr/lib/libGLcore.so.1.0.3123
-rw-r--r--  1 root root 7583760 Jul 19 00:32 /usr/lib/libGLcore.so.1.0.7174
lrwxrwxrwx  1 root root      12 Sep 27 00:22 /usr/lib/libGL.so -> libGL.so.1.2
lrwxrwxrwx  1 root root      17 Jul 23 18:29 /usr/lib/libGL.so.1 -> libGL.so.1.0.7174
-rwxr-xr-x  1 root root  283444 Apr  4  2003 /usr/lib/libGL.so.1.0.3123
-rw-r--r--  1 root root  482240 Jul 19 00:32 /usr/lib/libGL.so.1.0.7174
lrwxrwxrwx  1 root root      21 Sep 27 00:22 /usr/lib/libGLU.a -> ../X11R6/lib/libGLU.a
lrwxrwxrwx  1 root root      13 Sep 27 00:22 /usr/lib/libGLU.so -> libGLU.so.1.3
lrwxrwxrwx  1 root root      13 Sep 27 00:22 /usr/lib/libGLU.so.1 -> libGLU.so.1.3
lrwxrwxrwx  1 root root      26 Sep 27 00:22 /usr/lib/libGLU.so.1.3 -> ../X11R6/lib/libGLU.so.1.3


It seems like I do have a /usr/lib/libGL.so, at least as
a link pointing to libGL.so.1.2, so I didn't understand why
I get 

 /usr/lib/libGL.so: cannot open shared object file: No such file or directory

error.

Any suggestions?


Thanks in advance.

-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr
From: Bulent Murtezaoglu
Subject: Re: Stupid binary clock
Date: 
Message-ID: <873bnrfpdz.fsf@p4.internal>
>>>>> "ES" == Emre Sevinc <·····@bilgi.edu.tr> writes:
[...]
    ES> It seems like I do have a /usr/lib/libGL.so, at least as a
    ES> link pointing to libGL.so.1.2, so I didn't understand why I
    ES> get

    ES>  /usr/lib/libGL.so: cannot open shared object file: No such
    ES> file or directory

    ES> error.

    ES> Any suggestions?

I don't see a libGL.so.1.2 in that list.  It looks like a dangling 
symlink.  On my box (not deb. testing, pre x.org X) xlibmesa-gl provides 
that file.  Or just run ldconfig and try your luck.  

cheers,

BM
From: Emre Sevinc
Subject: Re: Stupid binary clock
Date: 
Message-ID: <87k6h3bgs3.fsf@ileriseviye.org>
Bulent Murtezaoglu <··@acm.org> writes:

>>>>>> "ES" == Emre Sevinc <·····@bilgi.edu.tr> writes:
> [...]
>     ES> It seems like I do have a /usr/lib/libGL.so, at least as a
>     ES> link pointing to libGL.so.1.2, so I didn't understand why I
>     ES> get
>
>     ES>  /usr/lib/libGL.so: cannot open shared object file: No such
>     ES> file or directory
>
>     ES> error.
>
>     ES> Any suggestions?
>
> I don't see a libGL.so.1.2 in that list.  It looks like a dangling 
> symlink.  On my box (not deb. testing, pre x.org X) xlibmesa-gl provides 
> that file.  Or just run ldconfig and try your luck.  

Strange thing is that, first I tried these:


debian:/home/fz# apt-get install xlibmesa-gl
Reading Package Lists... Done
Building Dependency Tree... Done
xlibmesa-gl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 629 not upgraded.

debian:/home/fz# apt-get install xlibmesa-gl-dev
Reading Package Lists... Done
Building Dependency Tree... Done
xlibmesa-gl-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 629 not upgraded.

because Debian package website says that ligGL.so.1.2
is part of xlibmesa-gl as you mentioned.

Then I also tried to ldconfig, without getting any errors.

Still no /usr/lib/libGL.so.1.2 :(

Is there any hope to use that OpenGL and SDL stuff from within 
Common Lisp?



-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr
From: Emre Sevinc
Subject: Re: Stupid binary clock
Date: 
Message-ID: <87fyrrbbtm.fsf@ileriseviye.org>
nabla <···············@nospam.gmail.com> writes:

> Emre Sevinc napisa�(a):
>
>> Happy hacking,
>> PS: Heh, if I or some other Lisp enthusiast can make a small hack
>> and create a small-window-but-graphical
>> binary clock application in Lisp, maybe I'll have another
>> chance to talk about Lisp on TV :)
>
> http://common-lisp.net/~rstrzalinski/binary-clock-app.lisp
>
> This is my simple binary clock. It uses opengl (via cl-sdl package).

Now I'm able to run your code (after some symbolic linking struggle
in Debian [thanks goes to BM for excellent, wise and patient round
the midnight tech support]).

Nice tiny app. :) to keep on tickin' at some
corner of the screen.

BTW, having "circle-shaped" LEDs would look much
nicer I guess (similar to what we see at ThinkGeek
watches and clocks). ;-)

Happy hacking,

-- 
Emre Sevinc

eMBA Software Developer         Actively engaged in:
http:www.bilgi.edu.tr           http://ileriseviye.org
http://www.bilgi.edu.tr         http://fazlamesai.net
Cognitive Science Student       http://cazci.com
http://www.cogsci.boun.edu.tr
From: Bulent Murtezaoglu
Subject: Re: Stupid binary clock
Date: 
Message-ID: <87y85je43h.fsf@p4.internal>
>>>>> "ES" == Emre Sevinc <·····@bilgi.edu.tr> writes:
[...]
    ES> BTW, having "circle-shaped" LEDs would look much nicer I guess
    ES> (similar to what we see at ThinkGeek watches and clocks). ;-)

Not only does he get tech support, Emre also gets his wishes tonight.  
Here's the little hack he got:

(let ((quadric-ht (make-hash-table :test #'equal)))
  (defun draw-led (x y on/off)
    (flet ((make-led (x y)
	     (let ((tl (gethash (list x y) quadric-ht)))
	       (if tl tl
		   (setf (gethash (list x y) quadric-ht)
			 (glu:new-quadric))))))
      (gl:color-3f 0f0 (if on/off 1f0 0.5f0) 0f0)
      (gl:push-matrix)
      (gl:translate-f (float x) (float y) 0.0)
      (glu:partial-disk (make-led x y) 0.0d0 (float *led-size* 0.0d0) 32 1 0.0d0 360.0d0)
      (gl:pop-matrix))))

Dunno how this fits in with the rest of the code, but it seems to work 
OK. (There doesn't seem to be a glu:disk in my cl-sdl.  That's how partial 
disk got in there.)

BM
From: nabla
Subject: Re: Stupid binary clock
Date: 
Message-ID: <2dd02$433ad090$540a2bbf$31401@news.chello.pl>
Bulent Murtezaoglu napisał(a):
>>>>>>"ES" == Emre Sevinc <·····@bilgi.edu.tr> writes:

> Dunno how this fits in with the rest of the code, but it seems to work 
> OK. (There doesn't seem to be a glu:disk in my cl-sdl.  That's how partial 
> disk got in there.)

Thanks. It fits well. Now I know how to draw a circle using GL.



-- 
Best regards,
Rafal Strzalinski (nabla)