unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Luis Souto Graña" <luissoutobueu@gmail.com>
To: guile-user@gnu.org
Subject: Function set-gl-vertex-array in Guile-opengl
Date: Fri, 25 Jan 2019 11:36:33 +0100	[thread overview]
Message-ID: <CA+0Zd=943A3mdMA8-ao5LkPB+xa86Q0-mxOpmkSQ=JLf73jE4g@mail.gmail.com> (raw)

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)))))))

(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))

> 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
.....

> (bytevector-length points)
900

> (bytevector->pointer points)
#<pointer 0x56090d909aa0>


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

Can someone tell me what the solution is?


             reply	other threads:[~2019-01-25 10:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 10:36 Luis Souto Graña [this message]
2019-01-26 10:33 ` Function set-gl-vertex-array in Guile-opengl Catonano
2019-01-26 16:02   ` Luis Souto Graña
     [not found] <mailman.136.1548435627.3559.guile-user@gnu.org>
2019-01-25 18:25 ` Daniel Llorens
2019-01-26  1:33   ` Luis Souto Graña
2019-01-26 12:52     ` Daniel Llorens
2019-01-26 12:58       ` Daniel Llorens
2019-01-26 16:05         ` Luis Souto Graña
2019-01-26 15:39           ` Daniel Llorens
2019-01-26 19:00             ` Luis Souto Graña
2019-01-28 13:30             ` Luis Souto Graña
2019-01-31 11:14               ` Luis Souto Graña
2019-02-09 18:59                 ` Luis Souto Graña

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+0Zd=943A3mdMA8-ao5LkPB+xa86Q0-mxOpmkSQ=JLf73jE4g@mail.gmail.com' \
    --to=luissoutobueu@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).