Hi sariug,
for the problem with execution_glsl, please try replacing tex_lookup_2d() and tex_texel_2d() in example_execution_glsl.frag by these functions:
// Implementation of tex::lookup_*() for a texture_2d texture.
vec4 tex_lookup_2d(uint tex, vec2 coord, int wrap_u, int wrap_v, vec2 crop_u, vec2 crop_v)
{
if (tex == 0u) return vec4(0);
switch (tex_start + tex - 1u)
{
case 0: return texture(material_texture_samplers_2d[ 0u], coord);
case 1: return texture(material_texture_samplers_2d[ 1u], coord);
case 2: return texture(material_texture_samplers_2d[ 2u], coord);
case 3: return texture(material_texture_samplers_2d[ 3u], coord);
case 4: return texture(material_texture_samplers_2d[ 4u], coord);
case 5: return texture(material_texture_samplers_2d[ 5u], coord);
case 6: return texture(material_texture_samplers_2d[ 6u], coord);
case 7: return texture(material_texture_samplers_2d[ 7u], coord);
case 8: return texture(material_texture_samplers_2d[ 8u], coord);
case 9: return texture(material_texture_samplers_2d[ 9u], coord);
case 10: return texture(material_texture_samplers_2d[10u], coord);
case 11: return texture(material_texture_samplers_2d[11u], coord);
case 12: return texture(material_texture_samplers_2d[12u], coord);
case 13: return texture(material_texture_samplers_2d[13u], coord);
case 14: return texture(material_texture_samplers_2d[14u], coord);
case 15: return texture(material_texture_samplers_2d[15u], coord);
case 16: return texture(material_texture_samplers_2d[16u], coord);
case 17: return texture(material_texture_samplers_2d[17u], coord);
case 18: return texture(material_texture_samplers_2d[18u], coord);
case 19: return texture(material_texture_samplers_2d[19u], coord);
case 20: return texture(material_texture_samplers_2d[20u], coord);
case 21: return texture(material_texture_samplers_2d[21u], coord);
case 22: return texture(material_texture_samplers_2d[22u], coord);
case 23: return texture(material_texture_samplers_2d[23u], coord);
case 24: return texture(material_texture_samplers_2d[24u], coord);
case 25: return texture(material_texture_samplers_2d[25u], coord);
case 26: return texture(material_texture_samplers_2d[26u], coord);
case 27: return texture(material_texture_samplers_2d[27u], coord);
case 28: return texture(material_texture_samplers_2d[28u], coord);
case 29: return texture(material_texture_samplers_2d[29u], coord);
case 30: return texture(material_texture_samplers_2d[30u], coord);
case 31: return texture(material_texture_samplers_2d[31u], coord);
default: return vec4(0);
}
}
// Implementation of tex::texel_*() for a texture_2d texture.
vec4 tex_texel_2d(uint tex, ivec2 coord, ivec2 uv_tile)
{
if (tex == 0u) return vec4(0);
switch (tex_start + tex - 1u)
{
case 0: return texelFetch(material_texture_samplers_2d[ 0u], coord, 0);
case 1: return texelFetch(material_texture_samplers_2d[ 1u], coord, 0);
case 2: return texelFetch(material_texture_samplers_2d[ 2u], coord, 0);
case 3: return texelFetch(material_texture_samplers_2d[ 3u], coord, 0);
case 4: return texelFetch(material_texture_samplers_2d[ 4u], coord, 0);
case 5: return texelFetch(material_texture_samplers_2d[ 5u], coord, 0);
case 6: return texelFetch(material_texture_samplers_2d[ 6u], coord, 0);
case 7: return texelFetch(material_texture_samplers_2d[ 7u], coord, 0);
case 8: return texelFetch(material_texture_samplers_2d[ 8u], coord, 0);
case 9: return texelFetch(material_texture_samplers_2d[ 9u], coord, 0);
case 10: return texelFetch(material_texture_samplers_2d[10u], coord, 0);
case 11: return texelFetch(material_texture_samplers_2d[11u], coord, 0);
case 12: return texelFetch(material_texture_samplers_2d[12u], coord, 0);
case 13: return texelFetch(material_texture_samplers_2d[13u], coord, 0);
case 14: return texelFetch(material_texture_samplers_2d[14u], coord, 0);
case 15: return texelFetch(material_texture_samplers_2d[15u], coord, 0);
case 16: return texelFetch(material_texture_samplers_2d[16u], coord, 0);
case 17: return texelFetch(material_texture_samplers_2d[17u], coord, 0);
case 18: return texelFetch(material_texture_samplers_2d[18u], coord, 0);
case 19: return texelFetch(material_texture_samplers_2d[19u], coord, 0);
case 20: return texelFetch(material_texture_samplers_2d[20u], coord, 0);
case 21: return texelFetch(material_texture_samplers_2d[21u], coord, 0);
case 22: return texelFetch(material_texture_samplers_2d[22u], coord, 0);
case 23: return texelFetch(material_texture_samplers_2d[23u], coord, 0);
case 24: return texelFetch(material_texture_samplers_2d[24u], coord, 0);
case 25: return texelFetch(material_texture_samplers_2d[25u], coord, 0);
case 26: return texelFetch(material_texture_samplers_2d[26u], coord, 0);
case 27: return texelFetch(material_texture_samplers_2d[27u], coord, 0);
case 28: return texelFetch(material_texture_samplers_2d[28u], coord, 0);
case 29: return texelFetch(material_texture_samplers_2d[29u], coord, 0);
case 30: return texelFetch(material_texture_samplers_2d[30u], coord, 0);
case 31: return texelFetch(material_texture_samplers_2d[31u], coord, 0);
default: return vec4(0);
}
}
And limiting MAX_TEXTURES in example_execution_glsl.cpp to 32 instead of 64.
This will ensure, that the array indices are constant at every texture function call and will additionally improve compatibility with very old graphic cards.
About the distilling_glsl example: Can you tell me, from where create_gl_texture() is called, when it fails, and what the values of target, w, h, format and levels are?
Best regards
Moritz