gl2 vs gl3: single plane matrix to gl.slab

    Oct 29 2020 | 4:13 am
    Hi, I've sometimes fed a float32 one-plane matrix to a My reasoning was that it would save some data duplication to avoid a conversion to a 4-plane matrix. It turns out that this doesn't work anymore with gl3: the one-plane matrix is then treated as a red plane. I could just convert my matrices to 4-plane (jit.pack or jit.matrix) But would someone point me in the right direction to massage the gl3 version of the shader in order to let the GPU use a single plane input on the internal RGB or RGBA? Here is a simple example working in gl2, but not in gl3.

    • Oct 29 2020 | 8:56 am
      You could sample the input matrix (which gets converted to a texture in lile this: vec4 myMatVal = texture(myMat, texcoord).rrrr; This would work in the shader I believe. Anyway why are you passing matrices to It could be more performant to make the calculation in jit.gen if you are working with matrices. Passing a one-plane matrix to the GPU is not much more efficient than passing a 4 planes matrix.
    • Oct 29 2020 | 1:17 pm
      Great, thanks for that! You made my day! (I wanted to avoid copying a 1-plane matrix into 4 planes of a 4-plane matrix.)