I have some data encoded in a floating point texture 2k by 2k. The data are longitude, latitude, time, and date as R,G,B,A. Those are all normalized but for now that is not a problem. I can de-normalize them later if i want to.

What i need now is to iterate through the whole texture and find what longitude, latitude should be in that fragment coordinate. I assume that the whole atlas has normalized coordinates and it maps the whole openGL context. Besides coordinates i will filter data with time and date but that is an if condition that is easy to be done. Because pixel coordinates that i have will not map exactly that coordinate i will use a small delta value to fix that issue for now and i will sue that delta value to precompute other points that are close to that co.

Now i have some driver crashes on iGPU (it should be out of memory or something similar) even if i want to add something in 2 for nested loops or even if I use a discard.

The code i now is this

NOTE f_time is the filter for the time and for now i have a slider so that i will have some interaction with the values.

Code :precision mediump float; precision mediump int; const int maxTextureSize = 2048; varying vec2 v_texCoord; uniform sampler2D u_texture; uniform float f_time; uniform ivec2 textureDimensions; void main(void) { float delta = 0.001;// now bigger delta just to make it work then we tune it // compute 1 pixel in texture coordinates. vec2 onePixel = vec2(1.0, 1.0) / float(textureDimensions.x); vec2 position = ( gl_FragCoord.xy / float(textureDimensions.x) ); vec4 color = texture2D(u_texture, v_texCoord); vec4 outColor = vec4(0.0); float dist_x = distance( color.r, gl_FragCoord.x); float dist_y = distance( color.g, gl_FragCoord.y); //float dist_x = distance( color.g, gl_PointCoord.s); //float dist_y = distance( color.b, gl_PointCoord.t); for(int i = 0; i < maxTextureSize; i++){ if(i < textureDimensions.x ){ break; } for(int j = 0; j < maxTextureSize ; j++){ if(j < textureDimensions.y ){ break; } // Where i am stuck now how to get the texture coordinate and test it with fragment shader // the precomputation vec4 pixel= texture2D(u_texture,vec2(i,j)); if(pixel.r > f_time){ outColor = vec4(1.0, 1.0, 1.0, 1.0); // for now just break, no delta calculation to sum this point with others so that // we will have an approximation of other points into that pixel break; } } } // this works if(color.t > f_time){ //gl_FragColor = color;//;vec4(1.0, 1.0, 1.0, 1.0); } gl_FragColor = outColor; }