Skip to main content

Posts

Showing posts with the label image pattern

OpenGL SL - Devide camera view

How can we devide camera view like above image? If you think adjusting the position and size by dividing each section, it will be a very difficult task. And If you made it that way, how can you make the following 10x10 image? The answer is "T o make pattern,  Use fract function." The full code is like below.  If you want to make 4x4 image, change this line : " uv *= 4.0; " void mainImage( out vec4 fragColor, in vec2 fragCoord ){     // Normalized pixel coordinates (from 0 to 1)     vec2 uv = fragCoord/iResolution.xy;     uv *= 10.0 ;     uv = fract (uv);     fragColor = texture (iChannel0, uv); } Declaration genType fract ( genType x ) Description returns the fractional part of  x . This is calculated as  x  -  floor ( x ). reference (  https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/fract.xhtml ) - Before fract fun...