You're right. I suposse I was missing the argument type, I thought that "type bv-or-pointer" was one thing.
I'm in Manjaro. I just did: Unzip guile-opengl-0.10.tar.gz $ ./configure --prefix=/usr $ make $ sudo make install And glut works well with (use-modules (gl) (glut)) The example of a circle works: (use-modules (gl) (glut)) (define PI 3.14159265358979324) (define radius 40.0) ; radius of circle (define x-center 50.0) ; x-coordinate of center of circle (define y-center 50.0) ; y-coordinate of center of circle (define num-vertices 5) ; number of vertices on circle (define t 0.0) ; angle parameter (define (init) (gl-ortho 0.0 100.0 0.0 100.0 -1.0 1.0) (set-gl-clear-color 1.0 1.0 1.0 0.0)) (define (draw-scene) (gl-clear (clear-buffer-mask color-buffer)) (gl-color 0 0 0) (gl-begin (begin-mode line-loop) (do ((i 1 (1+ i)))((> i num-vertices)) (gl-vertex (+ x-center (* radius (cos t))) (+ y-center (* radius (sin t))) 0.0) (set! t (+ t (/ (* 2 PI) num-vertices)))))) (define (on-display) (init) (draw-scene) (swap-buffers)) (initialize-glut #:window-size '(500 . 500)) (make-window "circle") (set-display-callback (lambda() (on-display))) (glut-main-loop) El sáb., 26 ene. 2019 a las 11:34, Catonano (<caton...@gmail.com>) escribió: > Hi Luis, > > I hadn't guile-opengl installed, so I downloaded, built it and installed > it uust to see if I could reproduce this error you are running into > > Il giorno ven 25 gen 2019 alle ore 15:58 Luis Souto Graña < > luissoutob...@gmail.com> ha scritto: > >> Hello, I'm trying to use the function set-gl-vertex-array in Guile-opengl >> . >> It needs a bytevector as an argument. I wrote this doing a copy-paste from >> here: >> https://github.com/marcomaggi/vicare/blob/master/attic/lab/gears.scm >> >> (use-modules (rnrs bytevectors)) >> (use-modules (system foreign)) >> >> (define (f32vector . lst) >> (define-syntax f32set! >> (syntax-rules () >> ((_ bv n value) >> (bytevector-ieee-single-native-set! bv (* n 30) value)))) >> (let ((bv (make-bytevector (* (length lst) 30)))) >> (let loop ((i 0) (lst lst)) >> (cond ((null? lst) bv) >> (else >> (f32set! bv i (car lst)) >> (loop (+ i 1) (cdr lst))))))) >> > > > In my test I used the f32vector that comes with guile, I don't know how > it's different from the one you are defining here > > > >> >> (define points (f32vector 30.0 30.0 0.0 >> 10.0 10.0 0.0 >> 70.0 30.0 0.0 >> 90.0 10.0 0.0 >> 70.0 70.0 0.0 >> 90.0 90.0 0.0 >> 30.0 70.0 0.0 >> 10.0 90.0 0.0 >> 30.0 30.0 0.0 >> 10.0 10.0 0.0)) >> > > Ok > > > >> > points >> #vu8(0 0 240 65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> 240 >> > > > in my case it's > > scheme@(guile-user)> points > $1 = #f32(30.0 30.0 0.0 10.0 10.0 0.0 70.0 30.0 0.0 90.0 10.0 0.0 70.0 > 70.0 0.0 90.0 90.0 0.0 30.0 70.0 0.0 10.0 90.0 0.0 30.0 30.0 0.0 10.0 10.0 > 0.0) > > I guess the difference is due to the fact that I used the one provided by > Guile > > ..... >> >> > (bytevector-length points) >> 900 >> > > > In my case: > > scheme@(guile-user)> (bytevector-length points) > $2 = 120 > > > >> > (bytevector->pointer points) >> #<pointer 0x56090d909aa0> >> > > > scheme@(guile-user)> (bytevector->pointer points) > $3 = #<pointer 0x5578953d25c0> > > >> >> >> So, it works well. >> >> Now, if I write: >> >> (use-modules (gl) (glut)) >> >> > ,apropos set-gl-vertex-array >> (gl): set-gl-vertex-array #<procedure set-gl-vertex-array (type >> bv-or-pointer #:optional size #:key stride offset)> >> >> >> > (set-gl-vertex-array (bytevector->pointer points) 3) >> >> ERROR: In procedure scm-error: >> unhandled array-pointer type 3 >> > > > > The first remark: the documentation you get with ,apropos reports: > > (gl): set-gl-vertex-array #<procedure set-gl-vertex-array (type > bv-or-pointer #:optional size #:key stride offset)> > > The function requires the first argument to be a "type" and the second > argument to be a pointer to a bytevector > > Now in your call to the function, the first argument you are passing is > not a type, it's a pointer to a bytevector > > And the second argument is an integer number (3) > > I don't now if the convention to express the types this function expects > is to use numbers (like in enumerations), it might be > > But the way you're calling it seems incorrect > > If you try to call it with a type first and then a pointer to a > bytevector, you might get a more interesting result > > In my case what I found out is that the linking to opengl is broken > > scheme@(guile-user)> (set-gl-vertex-array 3 (bytevector->pointer points) ) > ERROR: In procedure dynamic-link: > In procedure dynamic-link: file: "libglut", message: "file not found" > > Entering a new prompt. Type `,bt' for a backtrace or `,q' to continue. > scheme@(guile-user) [1]> > > > So the libglut file can't be found > > The libglut file should have been identified during the configuration > phase when I built guile-opengl > > But it hasn't, it seems > > I took a quick look at the guile-opengl configure.ac file and there's no > attempt at finding libglut > > Also, the compiled files get installed in > $(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/ccache > > all the other guile packages I have are installed in site-ccache, not in > ccache > > So when I ,use the glut related namespaces in the REPL they get compiled > right there and then > > I wondered if the unreachable ones in ccache are able to find libglut, > maybe because of some automagic mechanism I don't know about > > I tried to fix the position for compiled files in the Automake.am file but > the problem persists > > So this seems to be a lacking in the guile-opengl package > > In fact, I see that the only contributor to guile-opengl is Andy Wingo > > And putting the compiled files in ccache instead of site-ccache was a > thing in guile-fibers too > > All other guile packages I have, put compiled files in site-ccache, I > don't know why Andy has this habit and other packages have a different > habit ¯\_(ツ)_/¯ > > Often package authors can't deal with the Autotools, it seems to be too > hard not only for me. But I doubt Andy has this kind of difficutly, I > wonder why this is > > That said, being on Ubuntu 18.04.1 what should I install in order to have > libglut on my system ? > I see a libgle3 that seems a good candidate. Is that the right one ? > > If I had it I could try to sift through the internet myself and see if I > can improve the Autotools setup of guile-opengl > > From there on, you could explore the code more freely. > > OR you could already have a better installation than I have, I don't know > ¯\_(ツ)_/¯ >