#version 450 core layout( location = 0 ) uniform sampler2D u_InputTexture; layout( location = 1 ) uniform int u_LOD; layout( location = 0 ) out vec4 color; void main( void ) { #if 1 vec2 ts = textureSize( u_InputTexture , u_LOD ); vec2 tmp = gl_FragCoord.xy / vec2( 1280. , 720. ); ivec2 pos = ivec2( ts * tmp ); color = texelFetch( u_InputTexture , pos , u_LOD ); #else vec2 tmp = gl_FragCoord.xy / vec2( 1280. , 720. ); color = textureLod( u_InputTexture , tmp , float( u_LOD ) ); #endif }