From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Luis_Souto_Gra=C3=B1a?= Newsgroups: gmane.lisp.guile.user Subject: Re: Function set-gl-vertex-array in Guile-opengl Date: Sat, 26 Jan 2019 17:02:19 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="44646"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Guile User To: Catonano Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Jan 26 16:03:21 2019 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gnPUO-000BRP-5u for guile-user@m.gmane.org; Sat, 26 Jan 2019 16:03:20 +0100 Original-Received: from localhost ([127.0.0.1]:60481 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnPUN-00023L-7i for guile-user@m.gmane.org; Sat, 26 Jan 2019 10:03:19 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:46672) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gnPTt-00023F-KZ for guile-user@gnu.org; Sat, 26 Jan 2019 10:02:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gnPTo-0003Nk-GL for guile-user@gnu.org; Sat, 26 Jan 2019 10:02:49 -0500 Original-Received: from mail-it1-x130.google.com ([2607:f8b0:4864:20::130]:36854) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gnPTn-0003Ia-6P for guile-user@gnu.org; Sat, 26 Jan 2019 10:02:44 -0500 Original-Received: by mail-it1-x130.google.com with SMTP id c9so13719909itj.1 for ; Sat, 26 Jan 2019 07:02:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jPXd38Fkj0gHc/5jA1TWpP6fN0BfwN2eA5KWWwpvha8=; b=jidpV9cmALUBsiqajU1tTF26qsW7LpxsldGupDspnWE7DksEEHgENVQ7F9efgP0SUj xJ148TUnWw+W8ZwwWqj1sDxNpEKojzIjayPdolZKarsuTHF9Vam7cfixHNWyjlHQCQQT pbuDlTMoHwmuuwnsb1MM5ABzQ5JcgkEFb2OKBDsm/FRXNm4RwyFr0gwRwjOrRaI6Y/CV 3X0bMfBIDrg0vb4CdQaaGc/UXpnCDRGWQ+QFCIhq/uHyYxIThYBxG1x4cf/lggun+mw9 5PTM5kQYJ18ofl4cSDPGAdVhKKJphjHtKfZfaH58BkHbPNDP4ro3N5PHCOwCn/RjCWab Dn3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jPXd38Fkj0gHc/5jA1TWpP6fN0BfwN2eA5KWWwpvha8=; b=X/duqZDdU3yOF+0BxvQSDFtb0oVXN46Fwh/Ik4nQ+PiqWTMUE0Ufe+V9VqAnqcPwox SVUmushOf75re7mLQdIJrDE5N+U8xWHS1ygiNraC+RD13jxQXfQobj0P7BOgxeis2wJ3 vfWAiriwBSlxmudkVrMxG/xMZ/U5odyr8tocxuzXTFSIz0ERZvHbKaisbYcmA0fYD5oI ST3jw+3/2uPpZkANnbozy6Jx78W22fNLAoA9JHD6VJHtryKNAGiLBzZQfnd52e9/B2QE yNXqmDU7ka6KLM+KtvZhS72ihQrhxfQFq7oOyfkE8B62RXItV+mud2Esy1kCnXO4u4X9 KsJg== X-Gm-Message-State: AJcUukewG5C3bhB+NVVbSqteT5MxRyhsd2pKSWVsU27til41aGo+44e5 yfW9cx10XiIXI2gzDBAhRRcrj3Z82dBaKeEeJoM= X-Google-Smtp-Source: ALg8bN4wAA3tM27u1smjOIZaVqyAg5kbjn7Cb3TZJ3eMcbQ2batTa5LATvfr3OtZHcemk92Us3gWJe+kGiCHeGpRRfI= X-Received: by 2002:a02:a003:: with SMTP id a3mr10162191jah.8.1548514951204; Sat, 26 Jan 2019 07:02:31 -0800 (PST) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::130 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.org gmane.lisp.guile.user:15261 Archived-At: 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=3D/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=C3=A1b., 26 ene. 2019 a las 11:34, Catonano () esc= ribi=C3=B3: > 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=C3=B1a < > luissoutobueu@gmail.com> ha scritto: > >> Hello, I'm trying to use the function set-gl-vertex-array in Guile-openg= l >> . >> It needs a bytevector as an argument. I wrote this doing a copy-paste fr= om >> 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 =3D #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 =3D 120 > > > >> > (bytevector->pointer points) >> # >> > > > scheme@(guile-user)> (bytevector->pointer points) > $3 =3D # > > >> >> >> So, it works well. >> >> Now, if I write: >> >> (use-modules (gl) (glut)) >> >> > ,apropos set-gl-vertex-array >> (gl): set-gl-vertex-array #> 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 # 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 bu= t > 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 =C2=AF\_(=E3=83=84)_/=C2=AF > > 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 > =C2=AF\_(=E3=83=84)_/=C2=AF >