From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Llorens Newsgroups: gmane.lisp.guile.user Subject: Re: Function set-gl-vertex-array in Guile-opengl Date: Fri, 25 Jan 2019 19:25:51 +0100 Message-ID: References: Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) 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="249424"; mail-complaints-to="usenet@blaine.gmane.org" Cc: luissoutobueu@gmail.com To: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Jan 25 19:26:19 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 1gn6BG-0012jJ-12 for guile-user@m.gmane.org; Fri, 25 Jan 2019 19:26:18 +0100 Original-Received: from localhost ([127.0.0.1]:48942 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gn6BE-00045D-SJ for guile-user@m.gmane.org; Fri, 25 Jan 2019 13:26:16 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:54065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gn6Av-000454-GC for guile-user@gnu.org; Fri, 25 Jan 2019 13:25:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gn6Au-00020k-Ab for guile-user@gnu.org; Fri, 25 Jan 2019 13:25:57 -0500 Original-Received: from vimdzmsp-sfwd06.bluewin.ch ([195.186.227.133]:59398) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gn6Au-0001zB-0F for guile-user@gnu.org; Fri, 25 Jan 2019 13:25:56 -0500 Original-Received: from 4box.home ([100.91.106.162]) by vimdzmsp-sfwd06.bluewin.ch Swisscom AG with SMTP id n6AqgdJfQPUAYn6Aqg4OOo; Fri, 25 Jan 2019 19:25:53 +0100 X-Bluewin-Spam-Analysis: v=2.1 cv=P4n3/n0u c=1 sm=1 tr=0 a=E/cB+Ag6Owp6h9AtTK67vw==:117 a=E/cB+Ag6Owp6h9AtTK67vw==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=pGLkceISAAAA:8 a=mDV3o1hIAAAA:8 a=cda0nxGdAAAA:20 a=_qg4nlxY2CUiTlnrcRoA:9 a=WONkQfyV5K6IlHZf:21 a=zKxodyUnoVMm3c87:21 a=QEXdDO2ut3YA:10 a=OH8izRdxc4bYWovD54IA:9 a=_VxyLcG2QSgG-p2W:21 a=xjTJ8r0CauqDHcvR:21 a=nE0wunYbWhF0vTWL:21 a=_W_S_7VecoQA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-Bluewin-Spam-Score: 0.00 X-FXIT-IP: IPv4[100.91.106.162] Epoch[1548440753] X-Bluewin-AuthAs: dll@bluewin.ch In-Reply-To: X-Mailer: Apple Mail (2.3445.102.3) X-CMAE-Envelope: MS4wfEkQpkH3ZhWN3tvg3oP1HhbWcayGLk5Pv7BfwQKGhkZ81+pbngDB3rRAEyohsHcisVxpPkBngtlqizFhy8QXOejjikWj2hE4IRgjpVYAdlUHnd+O1Tbb AZL6l3HultEYj3gW+4I4QC8U4ImLhlx7RZ1b+PsfmtGsu5eqsjh3ajd9FepuUfvllAm6sT4gyNYewn8dtKsY3xDeGdcS1Gg3rVI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 195.186.227.133 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:15256 Archived-At: Hi Luis,=20 I don't really have an answer to your question, but I wanted to point = out that Guile already has make-f32vector, f32vector-set!, etc. You = don't need to define your own. IMO it's not a good idea to use = bytevector-xxx-set!/ref to operate on typed vectors unless you are type = punning. The make-f32vector, etc. functions are in SRFI-4, they aren't specific = to Guile. PS I didn't understand the purpose of (* n 30) on your code. The = original you link has (* n 4) which is what I'd expect for f32. Regards Daniel > From: Luis Souto Gra=C3=B1a > Subject: Function set-gl-vertex-array in Guile-opengl > Date: 25 January 2019 at 11:36:33 CET > To: guile-user@gnu.org >=20 >=20 > 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 >=20 > (use-modules (rnrs bytevectors)) > (use-modules (system foreign)) >=20 > (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))))))) >=20 > (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)) >=20 >> 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 > ..... >=20 >> (bytevector-length points) > 900 >=20 >> (bytevector->pointer points) > # >=20 >=20 > So, it works well. >=20 > Now, if I write: >=20 > (use-modules (gl) (glut)) >=20 >> ,apropos set-gl-vertex-array > (gl): set-gl-vertex-array # bv-or-pointer #:optional size #:key stride offset)> >=20 >=20 >> (set-gl-vertex-array (bytevector->pointer points) 3) >=20 > ERROR: In procedure scm-error: > unhandled array-pointer type 3 >=20 > Can someone tell me what the solution is? >=20 >=20 >=20 > _______________________________________________ > guile-user mailing list > guile-user@gnu.org > https://lists.gnu.org/mailman/listinfo/guile-user