It looks like you're new here. If you want to get involved, click one of these buttons!
void main() { vec2 coord = fTexCoord.xy; vec4 solidRed = vec4(0,0,0,0.2); if (fTexCoord.x > 0.5) { -- here I tried >= instead >, no sense solidRed.r = 0.5; } gl_FragColor = solidRed; } |
Comments
This happens because texture coordinates are not necessarily spanning from 0 to 1, depending on your texture size. Gideros internally ensures that textures are power of two sized, that is your texture if not power of two sized, gideros will allocate the nearest power of two size and adjust texture coordinates passed to the shader to account for this.
Since in your shader you use 'Shader.SYS_TEXTUREINFO', you can extract actual texture bounds from fTexSize uniform: fTexSize.x will be texture width (between 0 and 1) and fTexSize.y will be the height.
So your test should be:
Gosh, It works. Same thing on Bitmap from RenderTexture. I still didnt get how you find out this fix, because im floating in math, but still this works, I need to think about.