Integer/byte textures

I would like to use 2-component byte texture. Something like LUMINANCE_ALPHA8I_EXT. Is it supported in jme3?

I need it for special palette based shader. First byte indicates palette type, second byte offset into palette. Palettes are defined as 10 groups of 64x256 textures (which I will join into bigger one for efficiency) with each type mapped to one of 64 choices for given objects.

It is generally simple job to resolve it in the shader - I will just pass palletteIndices[10] and then do texture lookup of something like (with interpolation disabled most probably, to avoid bleeding between different textures)

uvec2 tex = texture2D(texture, texCoords)
color = texelFetch2D(combinedPalettes,uvec2(paletteIndices[tex.y],tex.x))

and paletteIndices[10] being a material parameter.

you have a Luminance8Alpha8 image format. IMO it should be ok for what you want to do. LUMINANCE_ALPHA8I_EXT is not in opengl2 specs, it looks like it an nvidia only extension…not sure about this though.

So I can upload normal texture and access it with uvec2/uvec4 and it will work as expected, giving me 0-255 results on each channel? Haven’t considered it, might be just working - will give it a try, thanks.

Nope, cannot assign normalized texture directly to uvec4. Most probably, for now I will just have to do something like

vec2 tmp = texture2D(backgroundTex,texCoord);
uvec2 indices = uvec2(int(round(tmp.r255)),int(round(tmp.g255)));

(or maybe .a and .l, whatever is the proper thing for 2-component L/A textures).

If jme3 ever supports int textures, I can change it, but for now I suppose it will work good enough with multiplication/rounding.