Re: [fpc-pascal] Float packing

2017-11-06 Thread Ryan Joseph
> On Nov 6, 2017, at 7:36 PM, Karoly Balogh (Charlie/SGR) > wrote: > > But anyway, I guess this is not so useful for you any more. So if you can > tell what *actually* you want to do, like convert a vec4 of GLSL float to > Pascal, or convert a 32bit RGBA value to a GLSL vec4, maybe that would

Re: [fpc-pascal] Float packing

2017-11-06 Thread Marco van de Voort
In our previous episode, Karoly Balogh (Charlie/SGR) said: > > > > On Google I found a good method to have the compiler convert a word to > > an array of bytes using variant records such as: > > I'm not particularly fond of this method, because this is not endian safe. > It won't work on bigendian

Re: [fpc-pascal] Float packing

2017-11-06 Thread Karoly Balogh (Charlie/SGR)
Hi, On Mon, 6 Nov 2017, Ryan Joseph wrote: > I actually got the problem wrong and still haven’t figured it out so > here’s another go. > > I have a number which I need to encode as an RGB value each component > being 4 bytes (12 bytes total) so I need to extract each digit as a byte > (and then e

Re: [fpc-pascal] Float packing

2017-11-05 Thread Ryan Joseph
I actually got the problem wrong and still haven’t figured it out so here’s another go. I have a number which I need to encode as an RGB value each component being 4 bytes (12 bytes total) so I need to extract each digit as a byte (and then each byte back to a digit). It’s basic low level compu

Re: [fpc-pascal] Float packing

2017-11-05 Thread Ryan Joseph
> On Nov 6, 2017, at 10:43 AM, Ryan Joseph wrote: > > I have a number which I need to encode as an RGB value each component being 4 > bytes (12 bytes total) I don’t know why I typed this, each component is 1 byte obviously so each digit can be up to 255 for a total value of 255,255,255? Not

[fpc-pascal] Float packing

2017-11-05 Thread Ryan Joseph
I’m trying to pass a value between 1-1000 to an GLSL shader program which only supports floats with a precision of 1 decimal place so the plan is to pack the value into a vec4 (RGBA components between 0-1) which I could decode in the shader program. For example if I want to encode the value 50