[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Function set-gl-vertex-array in Guile-opengl
From: |
Luis Souto Graña |
Subject: |
Function set-gl-vertex-array in Guile-opengl |
Date: |
Fri, 25 Jan 2019 11:36:33 +0100 |
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?
- Function set-gl-vertex-array in Guile-opengl,
Luis Souto Graña <=
- Re: Function set-gl-vertex-array in Guile-opengl, Daniel Llorens, 2019/01/25
- Re: Function set-gl-vertex-array in Guile-opengl, Luis Souto Graña, 2019/01/25
- Re: Function set-gl-vertex-array in Guile-opengl, Daniel Llorens, 2019/01/26
- Re: Function set-gl-vertex-array in Guile-opengl, Daniel Llorens, 2019/01/26
- Re: Function set-gl-vertex-array in Guile-opengl, Luis Souto Graña, 2019/01/26
- Re: Function set-gl-vertex-array in Guile-opengl, Daniel Llorens, 2019/01/26
- Re: Function set-gl-vertex-array in Guile-opengl, Luis Souto Graña, 2019/01/26
- Re: Function set-gl-vertex-array in Guile-opengl, Luis Souto Graña, 2019/01/28