unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* Function set-gl-vertex-array in Guile-opengl
@ 2019-01-25 10:36 Luis Souto Graña
  2019-01-26 10:33 ` Catonano
  0 siblings, 1 reply; 13+ messages in thread
From: Luis Souto Graña @ 2019-01-25 10:36 UTC (permalink / raw)
  To: guile-user

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?


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
       [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
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Llorens @ 2019-01-25 18:25 UTC (permalink / raw)
  To: guile-user; +Cc: luissoutobueu


Hi Luis, 

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ña <luissoutobueu@gmail.com>
> Subject: Function set-gl-vertex-array in Guile-opengl
> Date: 25 January 2019 at 11:36:33 CET
> To: guile-user@gnu.org
> 
> 
> 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?
> 
> 
> 
> _______________________________________________
> guile-user mailing list
> guile-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/guile-user



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
  2019-01-25 18:25 ` Daniel Llorens
@ 2019-01-26  1:33   ` Luis Souto Graña
  2019-01-26 12:52     ` Daniel Llorens
  0 siblings, 1 reply; 13+ messages in thread
From: Luis Souto Graña @ 2019-01-26  1:33 UTC (permalink / raw)
  To: Daniel Llorens; +Cc: guile-user

I don't know how to get *#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...*
*from srfi-4. The coordinates are for a SquareAnnulus:
https://github.com/slackmoehrle/Computer-Graphics-Through-OpenGL-2nd/blob/master/Chapter3/SquareAnnulus1/squareAnnulus1.cpp
<https://github.com/slackmoehrle/Computer-Graphics-Through-OpenGL-2nd/blob/master/Chapter3/SquareAnnulus1/squareAnnulus1.cpp>*


*10 points x 3 coordinates = 30*

*If anyone could make an minimal example with set-gl-vertex-array I would
be very grateful.*

El vie., 25 ene. 2019 a las 19:25, Daniel Llorens (<
daniel.llorens@bluewin.ch>) escribió:

>
> Hi Luis,
>
> 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ña <luissoutobueu@gmail.com>
> *Subject: **Function set-gl-vertex-array in Guile-opengl*
> *Date: *25 January 2019 at 11:36:33 CET
> *To: *guile-user@gnu.org
>
>
> 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?
>
>
>
> _______________________________________________
> guile-user mailing list
> guile-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/guile-user
>
>
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
  2019-01-25 10:36 Function set-gl-vertex-array in Guile-opengl Luis Souto Graña
@ 2019-01-26 10:33 ` Catonano
  2019-01-26 16:02   ` Luis Souto Graña
  0 siblings, 1 reply; 13+ messages in thread
From: Catonano @ 2019-01-26 10:33 UTC (permalink / raw)
  To: Luis Souto Graña; +Cc: Guile User

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 <
luissoutobueu@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
¯\_(ツ)_/¯


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
  2019-01-26  1:33   ` Luis Souto Graña
@ 2019-01-26 12:52     ` Daniel Llorens
  2019-01-26 12:58       ` Daniel Llorens
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Llorens @ 2019-01-26 12:52 UTC (permalink / raw)
  To: Luis Souto Graña; +Cc: guile-user



> On 26 Jan 2019, at 02:33, Luis Souto Graña <luissoutobueu@gmail.com> wrote:


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


You should call set-gl-vertex-array like this:

(set-gl-vertex-array (bytevector->pointer points) #:stride 3)

That's what the #:key of the help means.

You can read about that here:

https://www.gnu.org/software/guile/manual/html_node/lambda_002a-and-define_002a.html#lambda_002a-and-define_002a


> I don't know how to get #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...
> from srfi-4. The coordinates are for a SquareAnnulus: https://github.com/slackmoehrle/Computer-Graphics-Through-OpenGL-2nd/blob/master/Chapter3/SquareAnnulus1/squareAnnulus1.cpp
> 
> 10 points x 3 coordinates = 30

I don't follow. You should still use (* n 4). Each f32 takes 4 bytes in the bytevector. bytevector-ieee-single-native-ref/set! takes byte addresses, not float addresses. The way you do it, you're putting the first 30.0 at byte 0, and the second 30.0 at byte 30, so it's not even aligned.

scheme@(guile-user)> (bytevector-ieee-single-native-ref #f32(1.2 3.4 5.6) 0)
$1 = 1.2000000476837158
scheme@(guile-user)> (bytevector-ieee-single-native-ref #f32(1.2 3.4 5.6) 4)
$2 = 3.4000000953674316
scheme@(guile-user)> (bytevector-ieee-single-native-ref #f32(1.2 3.4 5.6) 8)
$3 = 5.599999904632568

As you can see, in Guile, SRFI-4 vectors are bytevectors. The other way, check it out:

scheme@(guile-user)> (import (rnrs bytevectors))
scheme@(guile-user)> (bytevector-u8-ref #f32(3.14) 0)
$1 = 195
scheme@(guile-user)> (bytevector-u8-ref #f32(3.14) 1)
$2 = 245
scheme@(guile-user)> (bytevector-u8-ref #f32(3.14) 2)
$3 = 72
scheme@(guile-user)> (bytevector-u8-ref #f32(3.14) 3)
$4 = 64
scheme@(guile-user)> (bytevector-ieee-single-native-ref #u8(195 245 72 64) 0)
$5 = 3.140000104904175

But you shouldn't need to care about any of this. You can pass an f32 vector to any function that takes bytevectors if that bytevector is supposed to contain floats.

Don't use bytevector-ieee-single-ref/set!. Use make-f32vector, f32vector-set! and f32-vector-ref instead. Those take float addresses.

It's unnecessary and error prone to use the bytevector functions to handle typed vectors unless you really need to address the bytes.

Don't define your own f32vector. Use SRFI-4.

Regards

	Daniel






> 
> If anyone could make an minimal example with set-gl-vertex-array I would be very grateful.
> 
> El vie., 25 ene. 2019 a las 19:25, Daniel Llorens (<daniel.llorens@bluewin.ch>) escribió:
> 
> Hi Luis, 
> 
> 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ña <luissoutobueu@gmail.com>
>> Subject: Function set-gl-vertex-array in Guile-opengl
>> Date: 25 January 2019 at 11:36:33 CET
>> To: guile-user@gnu.org
>> 
>> 
>> 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?
>> 
>> 
>> 
>> _______________________________________________
>> guile-user mailing list
>> guile-user@gnu.org
>> https://lists.gnu.org/mailman/listinfo/guile-user
> 




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
  2019-01-26 12:52     ` Daniel Llorens
@ 2019-01-26 12:58       ` Daniel Llorens
  2019-01-26 16:05         ` Luis Souto Graña
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Llorens @ 2019-01-26 12:58 UTC (permalink / raw)
  To: Luis Souto Graña; +Cc: guile-user



> On 26 Jan 2019, at 13:52, Daniel Llorens <daniel.llorens@bluewin.ch> wrote:
> 
> 
> 
>> On 26 Jan 2019, at 02:33, Luis Souto Graña <luissoutobueu@gmail.com> wrote:
> 
> 
>>>> 
>>>> ,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)
>>> 
> 
> 
> You should call set-gl-vertex-array like this:
> 
> (set-gl-vertex-array (bytevector->pointer points) #:stride 3)

Actually this #:stride should probably be 12 = 3*4, I think.







^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
  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
  0 siblings, 2 replies; 13+ messages in thread
From: Daniel Llorens @ 2019-01-26 15:39 UTC (permalink / raw)
  To: Luis Souto Graña; +Cc: guile-user



> On 26 Jan 2019, at 17:05, Luis Souto Graña <luissoutobueu@gmail.com> wrote:
> 
> The structure of my byvector is:
> 
> 30.0(float) --- IEE754 converter -->  0x41F00000 (hexadecimal) --- little endian ---> 0000F041 --- hexadecimal to decimal converter ---> 00 00 240 65
> 
> But I didn't notice and there's a lot of zeros before the next 00 00 240 65. 
> 
> I have to study what is the structure of a f32vector in Guile. I don't know it. 

The storage of an f32vector is exactly the same as if you declared float a[n] in C, one float after another, each taking 4 bytes. Endianness doesn't matter if you are producing and consuming the floats on the same machine.

The source data is floats, OpenGL takes floats, you don't need to deal with bytes.




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
  2019-01-26 10:33 ` Catonano
@ 2019-01-26 16:02   ` Luis Souto Graña
  0 siblings, 0 replies; 13+ messages in thread
From: Luis Souto Graña @ 2019-01-26 16:02 UTC (permalink / raw)
  To: Catonano; +Cc: Guile User

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 (<catonano@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 <
> luissoutobueu@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
> ¯\_(ツ)_/¯
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
  2019-01-26 12:58       ` Daniel Llorens
@ 2019-01-26 16:05         ` Luis Souto Graña
  2019-01-26 15:39           ` Daniel Llorens
  0 siblings, 1 reply; 13+ messages in thread
From: Luis Souto Graña @ 2019-01-26 16:05 UTC (permalink / raw)
  To: Daniel Llorens; +Cc: guile-user

The structure of my byvector is:

30.0(float) --- IEE754 converter -->  0x41F00000 (hexadecimal) --- little
endian ---> 0000F041 --- hexadecimal to decimal converter ---> 00 00 240 65

But I didn't notice and there's a lot of zeros before the next 00 00 240
65.

I have to study what is the structure of a f32vector in Guile. I don't know
it.

I also have to see what you said about #:stride 3 .

Thanks.

El sáb., 26 ene. 2019 a las 13:58, Daniel Llorens (<
daniel.llorens@bluewin.ch>) escribió:

>
>
> > On 26 Jan 2019, at 13:52, Daniel Llorens <daniel.llorens@bluewin.ch>
> wrote:
> >
> >
> >
> >> On 26 Jan 2019, at 02:33, Luis Souto Graña <luissoutobueu@gmail.com>
> wrote:
> >
> >
> >>>>
> >>>> ,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)
> >>>
> >
> >
> > You should call set-gl-vertex-array like this:
> >
> > (set-gl-vertex-array (bytevector->pointer points) #:stride 3)
>
> Actually this #:stride should probably be 12 = 3*4, I think.
>
>
>
>
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
  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
  1 sibling, 0 replies; 13+ messages in thread
From: Luis Souto Graña @ 2019-01-26 19:00 UTC (permalink / raw)
  To: Daniel Llorens; +Cc: guile-user

Thank a lot, now at least I have clear f32vector structure.

El sáb., 26 ene. 2019 a las 16:39, Daniel Llorens (<
daniel.llorens@bluewin.ch>) escribió:

>
>
> > On 26 Jan 2019, at 17:05, Luis Souto Graña <luissoutobueu@gmail.com>
> wrote:
> >
> > The structure of my byvector is:
> >
> > 30.0(float) --- IEE754 converter -->  0x41F00000 (hexadecimal) ---
> little endian ---> 0000F041 --- hexadecimal to decimal converter ---> 00 00
> 240 65
> >
> > But I didn't notice and there's a lot of zeros before the next 00 00 240
> 65.
> >
> > I have to study what is the structure of a f32vector in Guile. I don't
> know it.
>
> The storage of an f32vector is exactly the same as if you declared float
> a[n] in C, one float after another, each taking 4 bytes. Endianness doesn't
> matter if you are producing and consuming the floats on the same machine.
>
> The source data is floats, OpenGL takes floats, you don't need to deal
> with bytes.
>
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
  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
  1 sibling, 1 reply; 13+ messages in thread
From: Luis Souto Graña @ 2019-01-28 13:30 UTC (permalink / raw)
  To: Daniel Llorens; +Cc: guile-user

Andy Wingo doesn't use f32vectors, he uses packed-struct.scm https://
github.com/guildhall/guile-opengl/blob/master/gl/contrib/packed-struct.scm
. There are bytevector-ieee-single-native-set in it.

It works because I wrote:

$ cd /home/spectrumgomas/guile-opengl-01.0/examples/particle-system
$ guile client-arrays.scm

And I see the particle system.

Now I just need to understand it. :)

El sáb., 26 ene. 2019 a las 16:39, Daniel Llorens (<
daniel.llorens@bluewin.ch>) escribió:

>
>
> > On 26 Jan 2019, at 17:05, Luis Souto Graña <luissoutobueu@gmail.com>
> wrote:
> >
> > The structure of my byvector is:
> >
> > 30.0(float) --- IEE754 converter -->  0x41F00000 (hexadecimal) ---
> little endian ---> 0000F041 --- hexadecimal to decimal converter ---> 00 00
> 240 65
> >
> > But I didn't notice and there's a lot of zeros before the next 00 00 240
> 65.
> >
> > I have to study what is the structure of a f32vector in Guile. I don't
> know it.
>
> The storage of an f32vector is exactly the same as if you declared float
> a[n] in C, one float after another, each taking 4 bytes. Endianness doesn't
> matter if you are producing and consuming the floats on the same machine.
>
> The source data is floats, OpenGL takes floats, you don't need to deal
> with bytes.
>
>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
  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
  0 siblings, 1 reply; 13+ messages in thread
From: Luis Souto Graña @ 2019-01-31 11:14 UTC (permalink / raw)
  To: Daniel Llorens; +Cc: guile-user

I think I almost have it. I made a minimal example with a square. It starts
but the square doesn't appear. If anyone finds where the fault is, please
let me know.

(use-modules (gl) (glut))
(use-modules (gl contrib packed-struct))

(define-packed-struct vertices
  (x float)
  (y float)
  (z float)
  (r float)
  (g float)
  (b float))

(define vertices-square (make-packed-array vertices 4))
(pack vertices-square 0 vertices 20.0 20.0 0.0 0.0 0.0 0.0)
(pack vertices-square 1 vertices 80.0 20.0 0.0 0.0 0.0 0.0)
(pack vertices-square 2 vertices 80.0 80.0 0.0 0.0 0.0 0.0)
(pack vertices-square 3 vertices 20.0 80.0 0.0 0.0 0.0 0.0)

;;vertices-square
;;#vu8(0 0 160 65 0 0 160 65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
;;     0 0 160 66 0 0 160 65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
;;     0 0 160 66 0 0 160 66 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
;;     0 0 160 65 0 0 160 66 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)


(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 polygon)
    ;;    (gl-vertex 20.0  20.0  0.0)
    ;;    (gl-vertex 80.0  20.0  0.0)
    ;;    (gl-vertex 80.0  80.0  0.0)
    ;;    (gl-vertex 20.0  80.0  0.0)))
    (set-gl-vertex-array (vertex-pointer-type float)
                          vertices-square
                          #:stride (packed-struct-size vertices)  ;; 24
                          #:offset (packed-struct-offset vertices x)) ;; 0
    (set-gl-color-array (color-pointer-type float)
                          vertices-square
                          #:stride (packed-struct-size vertices)  ;; 24
                          #:offset (packed-struct-offset vertices r)) ;; 12

    (gl-draw-arrays (begin-mode polygon) 0 (packed-array-length
vertices-square vertices)))  ;; 4

(define (on-display)
    (init)
    (draw-scene)
    (swap-buffers))

(initialize-glut #:window-size '(800 . 800))
(make-window "page 24")
(set-display-callback (lambda() (on-display)))
(glut-main-loop)


El lun., 28 ene. 2019 a las 14:30, Luis Souto Graña (<
luissoutobueu@gmail.com>) escribió:

> Andy Wingo doesn't use f32vectors, he uses packed-struct.scm https://
> github.com/guildhall/guile-opengl/blob/master/gl/contrib/packed-struct.scm
> . There are bytevector-ieee-single-native-set in it.
>
> It works because I wrote:
>
> $ cd /home/spectrumgomas/guile-opengl-01.0/examples/particle-system
> $ guile client-arrays.scm
>
> And I see the particle system.
>
> Now I just need to understand it. :)
>
> El sáb., 26 ene. 2019 a las 16:39, Daniel Llorens (<
> daniel.llorens@bluewin.ch>) escribió:
>
>>
>>
>> > On 26 Jan 2019, at 17:05, Luis Souto Graña <luissoutobueu@gmail.com>
>> wrote:
>> >
>> > The structure of my byvector is:
>> >
>> > 30.0(float) --- IEE754 converter -->  0x41F00000 (hexadecimal) ---
>> little endian ---> 0000F041 --- hexadecimal to decimal converter ---> 00 00
>> 240 65
>> >
>> > But I didn't notice and there's a lot of zeros before the next 00 00
>> 240 65.
>> >
>> > I have to study what is the structure of a f32vector in Guile. I don't
>> know it.
>>
>> The storage of an f32vector is exactly the same as if you declared float
>> a[n] in C, one float after another, each taking 4 bytes. Endianness doesn't
>> matter if you are producing and consuming the floats on the same machine.
>>
>> The source data is floats, OpenGL takes floats, you don't need to deal
>> with bytes.
>>
>>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Function set-gl-vertex-array in Guile-opengl
  2019-01-31 11:14               ` Luis Souto Graña
@ 2019-02-09 18:59                 ` Luis Souto Graña
  0 siblings, 0 replies; 13+ messages in thread
From: Luis Souto Graña @ 2019-02-09 18:59 UTC (permalink / raw)
  To: Daniel Llorens; +Cc: guile-user

I found the mistake. I only had to add two lines. It works.

(use-modules (gl) (glut))
(use-modules (gl contrib packed-struct))

(define-packed-struct vertices
  (x float)
  (y float)
  (z float)
  (r float)
  (g float)
  (b float))

(define vertices-square (make-packed-array vertices 4))
(pack vertices-square 0 vertices 20.0 20.0 0.0 0.0 0.0 0.0)
(pack vertices-square 1 vertices 80.0 20.0 0.0 0.0 0.0 0.0)
(pack vertices-square 2 vertices 80.0 80.0 0.0 0.0 0.0 0.0)
(pack vertices-square 3 vertices 20.0 80.0 0.0 0.0 0.0 0.0)

;;vertices-square
;;#vu8(0 0 160 65 0 0 160 65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
;;     0 0 160 66 0 0 160 65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
;;     0 0 160 66 0 0 160 66 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
;;     0 0 160 65 0 0 160 66 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)


(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-enable-client-state (enable-cap vertex-array))
    (gl-enable-client-state (enable-cap color-array))
    (set-gl-vertex-array (vertex-pointer-type float)
                          vertices-square
                          #:stride (packed-struct-size vertices)  ;; 24
                          #:offset (packed-struct-offset vertices x)) ;; 0
    (set-gl-color-array (color-pointer-type float)
                          vertices-square
                          #:stride (packed-struct-size vertices)  ;; 24
                          #:offset (packed-struct-offset vertices r)) ;; 12

    (gl-draw-arrays (begin-mode quads) 0 (packed-array-length
vertices-square vertices)))  ;; 4

(define (on-display)
    (init)
    (draw-scene)
    (swap-buffers))

(initialize-glut #:window-size '(800 . 800))
(make-window "hallelujah")
(set-display-callback (lambda() (on-display)))
(glut-main-loop)

El jue., 31 ene. 2019 a las 12:14, Luis Souto Graña (<
luissoutobueu@gmail.com>) escribió:

> I think I almost have it. I made a minimal example with a square. It
> starts but the square doesn't appear. If anyone finds where the fault is,
> please let me know.
>
> (use-modules (gl) (glut))
> (use-modules (gl contrib packed-struct))
>
> (define-packed-struct vertices
>   (x float)
>   (y float)
>   (z float)
>   (r float)
>   (g float)
>   (b float))
>
> (define vertices-square (make-packed-array vertices 4))
> (pack vertices-square 0 vertices 20.0 20.0 0.0 0.0 0.0 0.0)
> (pack vertices-square 1 vertices 80.0 20.0 0.0 0.0 0.0 0.0)
> (pack vertices-square 2 vertices 80.0 80.0 0.0 0.0 0.0 0.0)
> (pack vertices-square 3 vertices 20.0 80.0 0.0 0.0 0.0 0.0)
>
> ;;vertices-square
> ;;#vu8(0 0 160 65 0 0 160 65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> ;;     0 0 160 66 0 0 160 65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> ;;     0 0 160 66 0 0 160 66 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> ;;     0 0 160 65 0 0 160 66 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
>
>
> (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 polygon)
>     ;;    (gl-vertex 20.0  20.0  0.0)
>     ;;    (gl-vertex 80.0  20.0  0.0)
>     ;;    (gl-vertex 80.0  80.0  0.0)
>     ;;    (gl-vertex 20.0  80.0  0.0)))
>     (set-gl-vertex-array (vertex-pointer-type float)
>                           vertices-square
>                           #:stride (packed-struct-size vertices)  ;; 24
>                           #:offset (packed-struct-offset vertices x)) ;; 0
>     (set-gl-color-array (color-pointer-type float)
>                           vertices-square
>                           #:stride (packed-struct-size vertices)  ;; 24
>                           #:offset (packed-struct-offset vertices r)) ;; 12
>
>     (gl-draw-arrays (begin-mode polygon) 0 (packed-array-length vertices-square vertices)))  ;; 4
>
> (define (on-display)
>     (init)
>     (draw-scene)
>     (swap-buffers))
>
> (initialize-glut #:window-size '(800 . 800))
> (make-window "page 24")
> (set-display-callback (lambda() (on-display)))
> (glut-main-loop)
>
>
> El lun., 28 ene. 2019 a las 14:30, Luis Souto Graña (<
> luissoutobueu@gmail.com>) escribió:
>
>> Andy Wingo doesn't use f32vectors, he uses packed-struct.scm https://
>> github.com/guildhall/guile-ope
>> ngl/blob/master/gl/contrib/packed-struct.scm . There are
>> bytevector-ieee-single-native-set in it.
>>
>> It works because I wrote:
>>
>> $ cd /home/spectrumgomas/guile-opengl-01.0/examples/particle-system
>> $ guile client-arrays.scm
>>
>> And I see the particle system.
>>
>> Now I just need to understand it. :)
>>
>> El sáb., 26 ene. 2019 a las 16:39, Daniel Llorens (<
>> daniel.llorens@bluewin.ch>) escribió:
>>
>>>
>>>
>>> > On 26 Jan 2019, at 17:05, Luis Souto Graña <luissoutobueu@gmail.com>
>>> wrote:
>>> >
>>> > The structure of my byvector is:
>>> >
>>> > 30.0(float) --- IEE754 converter -->  0x41F00000 (hexadecimal) ---
>>> little endian ---> 0000F041 --- hexadecimal to decimal converter ---> 00 00
>>> 240 65
>>> >
>>> > But I didn't notice and there's a lot of zeros before the next 00 00
>>> 240 65.
>>> >
>>> > I have to study what is the structure of a f32vector in Guile. I don't
>>> know it.
>>>
>>> The storage of an f32vector is exactly the same as if you declared float
>>> a[n] in C, one float after another, each taking 4 bytes. Endianness doesn't
>>> matter if you are producing and consuming the floats on the same machine.
>>>
>>> The source data is floats, OpenGL takes floats, you don't need to deal
>>> with bytes.
>>>
>>>


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-02-09 18:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-25 10:36 Function set-gl-vertex-array in Guile-opengl Luis Souto Graña
2019-01-26 10:33 ` 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

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