Reinterpet bits cast float->int in GLSL

I want the GLSL equivalent of:


float f;
int   i = *(int *)&f;

Any way to do this? Prefer std method but dirty hacks OK. Have wanted this before and now I want it again.

Issue is texture buffers have one component type. I want to mix different types in one, ala interleaved VBOs.

What you want are the floatBitsToInt and intBitsToFloat functions. There are unsigned versions too.

Surprisingly, they’re in 3.30.

Perfect - thanks. Somehow I missed seeing that.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.